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

AnalyzedSentence Design #55

Closed
eiennohito opened this issue Sep 30, 2021 · 4 comments
Closed

AnalyzedSentence Design #55

eiennohito opened this issue Sep 30, 2021 · 4 comments
Assignees
Milestone

Comments

@eiennohito
Copy link
Collaborator

Prereq of #52

We want a ponter-generic version of return container for the result of analysis.

Rust API wants references/mut references; Python binding wants Arc.

@mh-northlander mh-northlander self-assigned this Sep 30, 2021
@eiennohito eiennohito added this to the 0.1 milestone Oct 1, 2021
@mh-northlander
Copy link
Collaborator

Considering to add MorphemeList following java/python:

struct MorphemeList<'a, T> {
    dictionary: T,
    input_text: &'a str,
    path: Vec<lattice::Node>
}

And let Morpheme have reference to MorhemeList:

struct Morpheme<'a, T> {
    list: &MorphemeList<'a, T>,
    index: usize,
    word_info: Option<WordInfo>, // for lazy load
}

MorhemeList<'a, T> will be returned from tokenizer<T>.tokenize(input: &'a str).
We may change the struct for the path field later.

@eiennohito
Copy link
Collaborator Author

In this formulation will it be usable in Pyo3? Even with wrappers.

@mh-northlander
Copy link
Collaborator

For python side I considered to create a variant with no generic parameter:

struct PyMorphemeList {
    dictionary: Arc<JapaneseDictionary>,
    input_text: String,
    path: Vec<lattice::Node>
}

struct PyMorpheme {
    list: Arc<PyMorphemeList>,
    index: usize,
    word_info: Option<PyWordInfo>
}

@eiennohito
Copy link
Collaborator Author

It would be nice if the Rust version of MorphemeList would be somehow reusable allocation-wise. At least in theory and not in the initial implementation.

For the Python that may be impossible (and Python FFI requires making copies for basically everything).

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

2 participants