I'm having a bit of difficulty, and I'm sure that it's due to my lack of familiarity with IKVM in particular. I'm using stanford-postagger-3.9.1 to run through texts and do basic POS tagging. So far, so good.
However, the next step for me is to get the actual properties of the edu.stanford.nlp.ling.TaggedWord object. For example, in the following code, it's essentially just building off of the (very helpful) examples:
var sentences = MaxentTagger.tokenizeText(new java.io.StringReader(InputText)).toArray();
foreach (ArrayList sentence in sentences)
{
var taggedSentence = tagger.tagSentence(sentence);
Iterator it = taggedSentence.iterator();
while (it.hasNext())
{
var token = it.next();
}
}
From here, however, I'm not really sure how to get the properties of token out as a string. I can see that it has 4 properties:
beginPosition (e.g., int 0)
endPosition (e.g., int 2)
str (e.g., string "My")
tag (e.g., string "PRP$")
What I'm looking to do is pull out the str and tag properties so that I can do some other stuff with that information. However, I'm coming up completely short on how to go about this. Any help at all would be greatly appreciated -- I feel like I've tried just about everything that I can think of. I'm sure that it's a simple solution, but I'm completely missing it right now.
Aside from this, fantastic project all around -- amazing work.
**EDIT: I think that I've figured it out. I'm not sure if this is the most efficient way to go about it, but an explicit conversion seems to work:
Iterator it = taggedSentence.iterator();
while (it.hasNext())
{
TaggedWord token = (TaggedWord)it.next();
}
I'm having a bit of difficulty, and I'm sure that it's due to my lack of familiarity with IKVM in particular. I'm using stanford-postagger-3.9.1 to run through texts and do basic POS tagging. So far, so good.
However, the next step for me is to get the actual properties of the edu.stanford.nlp.ling.TaggedWord object. For example, in the following code, it's essentially just building off of the (very helpful) examples:
From here, however, I'm not really sure how to get the properties of
token
out as a string. I can see that it has 4 properties:beginPosition
(e.g., int 0)endPosition
(e.g., int 2)str
(e.g., string "My")tag
(e.g., string "PRP$")What I'm looking to do is pull out the
str
andtag
properties so that I can do some other stuff with that information. However, I'm coming up completely short on how to go about this. Any help at all would be greatly appreciated -- I feel like I've tried just about everything that I can think of. I'm sure that it's a simple solution, but I'm completely missing it right now.Aside from this, fantastic project all around -- amazing work.
**EDIT: I think that I've figured it out. I'm not sure if this is the most efficient way to go about it, but an explicit conversion seems to work: