本文整理了Java中net.sf.extjwnl.data.Word.getLemma()
方法的一些代码示例,展示了Word.getLemma()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Word.getLemma()
方法的具体详情如下:
包路径:net.sf.extjwnl.data.Word
类名称:Word
方法名:getLemma
[英]Returns the lemma of this word.
[中]返回这个词的引理。
代码示例来源:origin: de.tudarmstadt.ukp.dkpro.wsd/de.tudarmstadt.ukp.dkpro.wsd.si.wordnet
@Override
public Set<String> getSynonyms()
{
if (synonyms != null) {
return synonyms;
}
synonyms = new HashSet<String>();
for (Word word : synset.getWords()) {
synonyms.add(word.getLemma().replace('_', ' '));
}
return synonyms;
}
代码示例来源:origin: de.tudarmstadt.ukp.uby/de.tudarmstadt.ukp.uby.integration.wordnet-gpl
/**
* This method consumes a targeted WordNet-synset, and returns the semantic label.<br>
* Semantic label is the lemma of the synset's first lexeme.
* @param targetSynset WordNet's synset from which the semantic label should be extracted
* @return the the lemma of the targetSynset's first lexeme
*/
private String getSemanticLabel(net.sf.extjwnl.data.Synset targetSynset) {
return targetSynset.getWords().get(0).getLemma();
}
代码示例来源:origin: hltfbk/Excitement-Open-Platform
public Set<String> getWords() throws WordNetException
{
if (words == null)
{
words = new LinkedHashSet<String>();
for (Word word : this.realSynset.getWords())
{
String lemma = word.getLemma();
lemma = lemma.replaceAll("_", " "); // clean
words.add(lemma);
}
}
return new LinkedHashSet<String>(words); // return a copy
}
代码示例来源:origin: de.tudarmstadt.ukp.dkpro.wsd/de.tudarmstadt.ukp.dkpro.wsd.si.wordnet
@Override
public Set<String> getSynonyms()
{
if (synonyms != null) {
return synonyms;
}
synonyms = new HashSet<String>(synset.getWords().size());
for (Word w : synset.getWords()) {
synonyms.add(w.getLemma());
}
return synonyms;
}
代码示例来源:origin: net.sf.extjwnl/extjwnl
/**
* Two words are equal if their parent Synsets are equal and they have the same lemma
*/
public boolean equals(Object object) {
return (object instanceof Word)
&& ((Word) object).getSynset().equals(getSynset())
&& ((Word) object).getLemma().equals(getLemma());
}
代码示例来源:origin: extjwnl/extjwnl
/**
* Two words are equal if their parent Synsets are equal and they have the same lemma
*/
public boolean equals(Object object) {
return (object instanceof Word)
&& ((Word) object).getSynset().equals(getSynset())
&& ((Word) object).getLemma().equals(getLemma());
}
代码示例来源:origin: de.tudarmstadt.ukp.dkpro.lexsemresource/de.tudarmstadt.ukp.dkpro.lexsemresource.wordnet-asl
public static Map<String, String> getSynsetLexemes(Synset synset)
{
Map<String, String> result = new HashMap<String, String>();
long sense = synset.getOffset();
List<Word> words = synset.getWords();
for (Word word : words) {
String lexeme = word.getLemma();
// remove some suffixes that might be added to the synset representation by JWNL
lexeme = cleanLexeme(lexeme);
result.put(lexeme, new Long(sense).toString());
}
return result;
}
代码示例来源:origin: net.sf.extjwnl/extjwnl
public int hashCode() {
return getSynset().hashCode() ^ getLemma().hashCode();
}
代码示例来源:origin: extjwnl/extjwnl
private void removeWordsFromSynset(Synset synset, String lemma) {
if (null != dictionary && dictionary.isEditable()) {
for (Word word : synset.getWords()) {
if (word.getLemma().equalsIgnoreCase(lemma)) {
synset.getWords().remove(word);
break;
}
}
}
}
代码示例来源:origin: net.sf.extjwnl/extjwnl
private void removeWordsFromSynset(Synset synset, String lemma) {
if (null != dictionary && dictionary.isEditable()) {
for (Word word : synset.getWords()) {
if (word.getLemma().equalsIgnoreCase(lemma)) {
synset.getWords().remove(word);
break;
}
}
}
}
代码示例来源:origin: lucene4ir/lucene4ir
public static Set<String> getSynonyms(String word) throws JWNLException {
IndexWord[] allWords = getWordArray(word);
if (allWords.length == 1) {
Set<String> retData = new HashSet<>();
for (Synset synset : allWords[0].getSenses()) {
for (Word wordObj : synset.getWords()) {
retData.add(wordObj.getLemma());
}
}
return retData;
}
return null;
}
代码示例来源:origin: net.sf.extjwnl/extjwnl
private static int getUseCount(Synset synset, String lemma) {
for (Word w : synset.getWords()) {
if (w.getLemma().equalsIgnoreCase(lemma)) {
if (0 < w.getUseCount()) {
return w.getUseCount();
}
}
}
return 0;
}
代码示例来源:origin: extjwnl/extjwnl
private static int getUseCount(Synset synset, String lemma) {
for (Word w : synset.getWords()) {
if (w.getLemma().equalsIgnoreCase(lemma)) {
if (0 < w.getUseCount()) {
return w.getUseCount();
}
}
}
return 0;
}
代码示例来源:origin: net.sf.extjwnl/extjwnl
public String toString() {
StringBuilder words = new StringBuilder();
for (int i = 0; i < this.words.size(); ++i) {
if (i > 0) {
words.append(", ");
}
words.append(this.words.get(i).getLemma());
}
if (getGloss() != null) {
words.append(" -- (").append(getGloss()).append(")");
}
return ResourceBundleSet.insertParams("[Synset: [Offset: {0}] {1} Words: {2}]",
new Object[]{getOffset(), getPOS(), words.toString()});
}
代码示例来源:origin: extjwnl/extjwnl
public String toString() {
StringBuilder words = new StringBuilder();
for (int i = 0; i < this.words.size(); ++i) {
if (i > 0) {
words.append(", ");
}
words.append(this.words.get(i).getLemma());
}
if (getGloss() != null) {
words.append(" -- (").append(getGloss()).append(")");
}
return ResourceBundleSet.insertParams("[Synset: [Offset: {0}] {1} Words: {2}]",
new Object[]{getOffset(), getPOS(), words.toString()});
}
代码示例来源:origin: net.sf.extjwnl/extjwnl
private void removeThisSynsetFromIndexWords(Word word) {
if (null != dictionary && dictionary.isEditable()) {
try {
IndexWord indexWord = dictionary.getIndexWord(getPOS(), word.getLemma());
if (null != indexWord) {
indexWord.getSenses().remove(Synset.this);
}
} catch (JWNLException e) {
throw new JWNLRuntimeException(e);
}
}
}
代码示例来源:origin: extjwnl/extjwnl
private void removeThisSynsetFromIndexWords(Word word) {
if (null != dictionary && dictionary.isEditable()) {
try {
IndexWord indexWord = dictionary.getIndexWord(getPOS(), word.getLemma());
if (null != indexWord) {
indexWord.getSenses().remove(Synset.this);
}
} catch (JWNLException e) {
throw new JWNLRuntimeException(e);
}
}
}
代码示例来源:origin: net.sf.extjwnl/extjwnl
public String toString() {
return ResourceBundleSet.insertParams("[Word: {0} [Lemma: {1}] {2} [Index: {3}]]", new Object[]{getPOS(), getLemma(), getSynset(), getIndex()});
}
代码示例来源:origin: net.sf.extjwnl/extjwnl-utilities
private static int getSenseNo(final Word word) throws JWNLException {
final IndexWord iw = word.getDictionary().getIndexWord(word.getPOS(), word.getLemma());
for (int i = 0; i < iw.getSenses().size(); i++) {
if (iw.getSenses().get(i).getOffset() == word.getSynset().getOffset()) {
return i;
}
}
return -1;
}
代码示例来源:origin: extjwnl/extjwnl
private static int getSenseNo(final Word word) throws JWNLException {
final IndexWord iw = word.getDictionary().getIndexWord(word.getPOS(), word.getLemma());
for (int i = 0; i < iw.getSenses().size(); i++) {
if (iw.getSenses().get(i).getOffset() == word.getSynset().getOffset()) {
return i;
}
}
return -1;
}
内容来源于网络,如有侵权,请联系作者删除!