Commit 27d0fb3c766873b258c6cbe335f27ee011481775
1 parent
0d48140d
- wyrzucenie niepotrzebnych metod (hasHomonym i toString) z klasy MorphInterpretation
git-svn-id: svn://svn.nlp.ipipan.waw.pl/morfeusz/trunk@248 ff4e3ee1-f430-4e82-ade0-24591c43f1fd
Showing
3 changed files
with
17 additions
and
43 deletions
morfeusz/MorphInterpretation.cpp
... | ... | @@ -45,40 +45,4 @@ namespace morfeusz { |
45 | 45 | return mi; |
46 | 46 | } |
47 | 47 | |
48 | - static inline bool hasEnding(const string &fullString, const string &ending) { | |
49 | - if (fullString.length() >= ending.length()) { | |
50 | - return (0 == fullString.compare(fullString.length() - ending.length(), ending.length(), ending)); | |
51 | - } | |
52 | - else { | |
53 | - return false; | |
54 | - } | |
55 | - } | |
56 | - | |
57 | - bool MorphInterpretation::hasHomonym(const string& homonymId) const { | |
58 | - size_t homonymSeparatorIdx = this->lemma.length() - homonymId.length() - 1; | |
59 | - return homonymSeparatorIdx > 0 | |
60 | - && this->lemma[homonymSeparatorIdx] == HOMONYM_SEPARATOR | |
61 | - && hasEnding(this->lemma, homonymId); | |
62 | - } | |
63 | - | |
64 | - std::string MorphInterpretation::toString(bool includeNodeNumbers) const { | |
65 | - std::stringstream res; | |
66 | - if (includeNodeNumbers) { | |
67 | - res << startNode << "," << endNode << ","; | |
68 | - } | |
69 | - res << orth << ","; | |
70 | - | |
71 | - res << lemma; | |
72 | - res << ","; | |
73 | - | |
74 | - // res << getTag(); | |
75 | - // if (!getName().empty()) { | |
76 | - // res << "," << getName(); | |
77 | - // } | |
78 | - // if (!getQualifiers().empty()) { | |
79 | - // res << "," << getQualifiersStr(*this); | |
80 | - // } | |
81 | - return res.str(); | |
82 | - } | |
83 | - | |
84 | 48 | } |
... | ... |
morfeusz/deserialization/morphInterps/InterpretedChunksDecoder4Generator.cpp
... | ... | @@ -12,6 +12,22 @@ |
12 | 12 | using namespace std; |
13 | 13 | |
14 | 14 | namespace morfeusz { |
15 | + | |
16 | + static bool hasEnding(const string &fullString, const string &ending) { | |
17 | + if (fullString.length() >= ending.length()) { | |
18 | + return (0 == fullString.compare(fullString.length() - ending.length(), ending.length(), ending)); | |
19 | + } | |
20 | + else { | |
21 | + return false; | |
22 | + } | |
23 | + } | |
24 | + | |
25 | + static bool hasHomonym(const MorphInterpretation& mi, const string& homonymId) { | |
26 | + size_t homonymSeparatorIdx = mi.lemma.length() - homonymId.length() - 1; | |
27 | + return homonymSeparatorIdx > 0 | |
28 | + && mi.lemma[homonymSeparatorIdx] == HOMONYM_SEPARATOR | |
29 | + && hasEnding(mi.lemma, homonymId); | |
30 | + } | |
15 | 31 | |
16 | 32 | InterpretedChunksDecoder4Generator::InterpretedChunksDecoder4Generator(const Environment& env) : InterpretedChunksDecoder(env) { |
17 | 33 | } |
... | ... | @@ -31,7 +47,7 @@ namespace morfeusz { |
31 | 47 | MorphInterpretation mi = this->decodeMorphInterpretation(startNode, endNode, orthPrefix, lemma, interpretedChunk, currPtr); |
32 | 48 | // cerr << mi.toString(false) << endl; |
33 | 49 | // cerr << "required='" << interpretedChunk.requiredHomonymId << "' morphInterp='" << mi.getHomonymId() << "'" << endl; |
34 | - if (interpretedChunk.requiredHomonymId.empty() || mi.hasHomonym(interpretedChunk.requiredHomonymId)) { | |
50 | + if (interpretedChunk.requiredHomonymId.empty() || hasHomonym(mi, interpretedChunk.requiredHomonymId)) { | |
35 | 51 | out.push_back(mi); |
36 | 52 | } |
37 | 53 | } |
... | ... |
morfeusz/morfeusz2.h
... | ... | @@ -358,12 +358,6 @@ namespace morfeusz { |
358 | 358 | return tagId == 1; |
359 | 359 | } |
360 | 360 | |
361 | - // FIXME - do wyrzucenia gdzie indziej | |
362 | - bool hasHomonym(const std::string& homonymId) const; | |
363 | - | |
364 | - // FIXME - do wyrzucenia gdzie indziej | |
365 | - std::string toString(bool includeNodeNumbers) const; | |
366 | - | |
367 | 361 | int startNode; |
368 | 362 | int endNode; |
369 | 363 | std::string orth; |
... | ... |