Skip to content
Snippets Groups Projects
Commit c0d84a91 authored by Radosław Warzocha's avatar Radosław Warzocha
Browse files

New morfeusz2 API adjustments

parent bef0195b
No related branches found
No related tags found
No related merge requests found
...@@ -83,12 +83,12 @@ bool Morfeusz2Analyser::process_functional(const Toki::Token &t, ...@@ -83,12 +83,12 @@ bool Morfeusz2Analyser::process_functional(const Toki::Token &t,
std::string s = PwrNlp::to_utf8(t.orth()); std::string s = PwrNlp::to_utf8(t.orth());
std::vector<details::Morfeusz2Edge> pmorf; std::vector<details::Morfeusz2Edge> pmorf;
Morfeusz *morf = Morfeusz::createInstance(); Morfeusz *morf = Morfeusz::createInstance(ANALYSE_ONLY);
morf->setCharset(charset); morf->setCharset(charset);
ResultsIterator *res_iter = morf->analyze(s); ResultsIterator *res_iter = morf->analyse(s);
while(res_iter->hasNext()) while(res_iter->hasNext())
pmorf.push_back(details::Morfeusz2Edge(res_iter->next())); pmorf.push_back(details::Morfeusz2Edge(res_iter->next(), morf));
if(pmorf.size() == 1 && pmorf[0].lemma.length() > 0) { // only one analysis if(pmorf.size() == 1 && pmorf[0].lemma.length() > 0) { // only one analysis
Corpus2::Token *tok = make_token(t, pmorf[0]); Corpus2::Token *tok = make_token(t, pmorf[0]);
...@@ -261,11 +261,12 @@ std::string Morfeusz2Error::info() const ...@@ -261,11 +261,12 @@ std::string Morfeusz2Error::info() const
} }
namespace details { namespace details {
Morfeusz2Edge::Morfeusz2Edge(const morfeusz::MorphInterpretation& morf) Morfeusz2Edge::Morfeusz2Edge(const morfeusz::MorphInterpretation interp,
: node_from(morf.getStartNode()), node_to(morf.getEndNode()) const morfeusz::Morfeusz * morf)
, orth(UnicodeString::fromUTF8(morf.getOrth())) : node_from(interp.startNode), node_to(interp.endNode)
, lemma(UnicodeString::fromUTF8(morf.getLemma())) , orth(UnicodeString::fromUTF8(interp.orth))
, tag_string(morf.getTag()), token(NULL) , lemma(UnicodeString::fromUTF8(interp.lemma))
, tag_string(morf->getIdResolver().getTag(interp.tagId)), token(NULL)
{ {
} }
} }
......
...@@ -137,7 +137,8 @@ namespace details { ...@@ -137,7 +137,8 @@ namespace details {
/// Helper struct for holding preprocessed Morfeusz results /// Helper struct for holding preprocessed Morfeusz results
struct Morfeusz2Edge struct Morfeusz2Edge
{ {
explicit Morfeusz2Edge(const morfeusz::MorphInterpretation& morf); explicit Morfeusz2Edge(const morfeusz::MorphInterpretation interp,
const morfeusz::Morfeusz * morf);
int node_from, node_to; int node_from, node_to;
UnicodeString orth; UnicodeString orth;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment