PolMine / dbpedia

R Wrapper for Corpus Annotation with DBpedia Spotlight
3 stars 0 forks source link

`entity_types_map()` does not work reliably #40

Open ChristophLeonhardt opened 8 months ago

ChristophLeonhardt commented 8 months ago

This concerns the version of the package on the entity_types branch. The line

https://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 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:

https://github.com/PolMine/dbpedia/blob/f4dc779cdd7856f7f1130ccc16917306799783f4/R/entity_types.R#L81-L87

Then, the assignment should work as expected.

Two notes here: