Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warning when querying an s-attribute which is not available in subcorpus #287

Open
ChristophLeonhardt opened this issue Mar 4, 2024 · 0 comments

Comments

@ChristophLeonhardt
Copy link
Contributor

In the following chunk I try to identify which types of named entities occur in a particular paragraph. In this case, the paragraph does not contain any named entities. This is returned by s_attributes() as "character(0)". I assume that this is okay. However, s_attributes() also prints a warning message each time this happens.

library(polmineR)
paragraph <- corpus("GERMAPARL2") |>
  subset(protocol_date == "1949-09-07") |>
  split(s_attribute = "p_type", values = FALSE) |>
  _[[2]]

s_attributes(paragraph, "ne_type")

character(0)
Warning message:
In check_strucs(corpus = corpus, s_attribute = s_attribute, strucs = struc, :
struc vector has length 0

I assume that this warning message is there because there probably are scenarios in which missing struc vectors have potentially negative implications. However, in this case, I would think that s_attributes() does what it is supposed to do?

So, from a user perspective, what should I make of this warning? Maybe it should be more telling? On another note, if the object is not a single subcorpus but a subcorpus bundle, this warning might be shown a lot of times. This can be irritating if returning "character(0)" is, in fact, correct behavior of s_attributes().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant