which was used in a similar function earlier causes issues in entity_types_map(). This is already anticipated in the comments surrounding this line. Long story short: Earlier, a list of lists was passed to the function (as an object corresponding to el here). Now, el is already a list itself, so does not need to be unlisted. If unlisted, the names of the resulting character vector probably won't match the mapping_vector. In consequence, all entities in the data.table are assigned to the category defined in the argument other.
To address this, I think it would suffice to omit the line quoted above. And instead of type_list in the following chunk, you would use el directly here:
It might be worth considering changing the name of the resulting column in the data.table from "class" to "category" as this wording is indeed unclear.
A similar issue occurs with the "old" map_type_to_class() function. Here, the issue results in a different outcome, assigning all classes to all entities as currently visible in the README. This can be addressed in a similar fashion, but if the function is replaced by entity_types_map() fixing the former seems more important.
This concerns the version of the package on the
entity_types
branch. The linehttps://github.com/PolMine/dbpedia/blob/f4dc779cdd7856f7f1130ccc16917306799783f4/R/entity_types.R#L77
which was used in a similar function earlier causes issues in
entity_types_map()
. This is already anticipated in the comments surrounding this line. Long story short: Earlier, a list of lists was passed to the function (as an object corresponding toel
here). Now,el
is already a list itself, so does not need to be unlisted. If unlisted, the names of the resulting character vector probably won't match themapping_vector
. In consequence, all entities in the data.table are assigned to the category defined in the argumentother
.To address this, I think it would suffice to omit the line quoted above. And instead of
type_list
in the following chunk, you would useel
directly here:https://github.com/PolMine/dbpedia/blob/f4dc779cdd7856f7f1130ccc16917306799783f4/R/entity_types.R#L81-L87
Then, the assignment should work as expected.
Two notes here:
map_type_to_class()
function. Here, the issue results in a different outcome, assigning all classes to all entities as currently visible in the README. This can be addressed in a similar fashion, but if the function is replaced byentity_types_map()
fixing the former seems more important.