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

CL function to check whether s-attribute has values #77

Closed
ablaette opened this issue Mar 24, 2023 · 2 comments
Closed

CL function to check whether s-attribute has values #77

ablaette opened this issue Mar 24, 2023 · 2 comments

Comments

@ablaette
Copy link
Collaborator

We should expose this function I find in cl.h

int cl_struc_values(Attribute *attribute);
@ablaette
Copy link
Collaborator Author

In fact, this function is exposed, but it is flawed: Using it triggers loading the corpus with a different directory, see the following example.

library(polmineR)
library(RcppCWB)
use("GermaParl2")


corpus_registry_dir("GERMAPARL2MINI") # 1 registry dir

x <- corpus("GERMAPARL2MINI")
corpus_registry_dir("GERMAPARL2MINI") # 1 registry dir

cl_struc_values(
  corpus = x@corpus,
  s_attribute = "p",
  registry = x@registry_dir
)
corpus_registry_dir("GERMAPARL2MINI") # 2nd registry dir returned

@ablaette
Copy link
Collaborator Author

I think this is an issue with using normalizePath() in cl_struc_values(). See the function definition:

cl_struc_values <- function(corpus, s_attribute, registry = Sys.getenv("CORPUS_REGISTRY")){
  check_corpus(corpus = corpus, registry = registry, cqp = FALSE)
  registry <- normalizePath(path.expand(registry))
  .cl_struc_values(corpus = corpus, s_attribute = s_attribute, registry = registry)
}

On macOS, normalizePath() will happen "/private" to the path, see:

tempdir()
normalizePath(tempdir())

ablaette pushed a commit that referenced this issue Oct 27, 2023
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