Package org.lionsoul.jcseg.segmenter
Class Word
- java.lang.Object
-
- org.lionsoul.jcseg.segmenter.Word
-
- All Implemented Interfaces:
Serializable,Cloneable,IWord
public class Word extends Object implements IWord, Cloneable, Serializable
word class for Jcseg with theIWordinterface implemented at 2017/03/29: make the synonym series methodgetSyn()setSyn(SynonymsEntry)and the part of speech series methodgetPartSpeech()setPartSpeech(String[])addPartSpeech(String)and theclone()method synchronized for might happen concurrent access.- Author:
- chenxin
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.lionsoul.jcseg.IWord
EN_POSPEECH, MIX_POSPEECH, NAME_POSPEECH, NUMERIC_POSPEECH, PPT_POSPEECH, PUNCTUATION, QUANTIFIER, T_BASIC_LATIN, T_CJK_PINYIN, T_CJK_WORD, T_CN_NAME, T_CN_NICKNAME, T_CN_NUMERIC, T_LETTER_NUMBER, T_MIXED_WORD, T_OTHER_NUMBER, T_PUNCTUATION, T_UNRECOGNIZE_WORD, TIME_POSPEECH, UNRECOGNIZE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String__toString()for debug onlyvoidaddEntity(String e)append a new entityvoidaddPartSpeech(String ps)add a new part to speech to the word.IWordclone()Interface to clone the current objectbooleanequals(Object o)you have to rewrite the #equals method cause the Jcseg require itString[]getEntity()get the entity name array of the wordStringgetEntity(int idx)get the specified entity by indexintgetFrequency()return the frequency of the word, use only when the word's length is one.intgetLength()return the length of the wordStringgetParameter()return the additional parametersString[]getPartSpeech()return the part of speech of the word.StringgetPinyin()return the pinyin of the wordintgetPosition()return the start position of the word.SynonymsEntrygetSyn()return the Synonyms' entry of the word.intgetType()return the type of the wordStringgetValue()return the value of the wordinthashCode()rewrite the hash code generate algorithm take the value as the main factorvoidsetEntity(String[] entity)set the entity name array of the wordvoidsetEntityForNull(String[] entity)voidsetFrequency(int freq)set the frequency of the wordvoidsetLength(int length)self define the lengthvoidsetParameter(String param)set the string parametersvoidsetPartSpeech(String[] partSpeech)voidsetPartSpeechForNull(String[] partSpeech)voidsetPinyin(String py)set the pinyin of the wordvoidsetPosition(int pos)set the position of the wordvoidsetSyn(SynonymsEntry syn)voidsetType(int type)set the type of the wordStringtoString()
-
-
-
Method Detail
-
getValue
public String getValue()
Description copied from interface:IWordreturn the value of the word- Specified by:
getValuein interfaceIWord- See Also:
IWord.getValue()
-
getLength
public int getLength()
Description copied from interface:IWordreturn the length of the word- Specified by:
getLengthin interfaceIWord- See Also:
IWord.getLength()
-
setLength
public void setLength(int length)
Description copied from interface:IWordself define the length- Specified by:
setLengthin interfaceIWord- See Also:
IWord.setLength(int)
-
getFrequency
public int getFrequency()
Description copied from interface:IWordreturn the frequency of the word, use only when the word's length is one.- Specified by:
getFrequencyin interfaceIWord- See Also:
IWord.getFrequency()
-
setFrequency
public void setFrequency(int freq)
Description copied from interface:IWordset the frequency of the word- Specified by:
setFrequencyin interfaceIWord
-
getType
public int getType()
Description copied from interface:IWordreturn the type of the word- Specified by:
getTypein interfaceIWord- See Also:
IWord.getType()
-
setType
public void setType(int type)
Description copied from interface:IWordset the type of the word- Specified by:
setTypein interfaceIWord- See Also:
IWord.setType(int)
-
setPosition
public void setPosition(int pos)
Description copied from interface:IWordset the position of the word- Specified by:
setPositionin interfaceIWord- See Also:
IWord.setPosition(int)
-
getPosition
public int getPosition()
Description copied from interface:IWordreturn the start position of the word.- Specified by:
getPositionin interfaceIWord- See Also:
IWord.getPosition()
-
getEntity
public String[] getEntity()
Description copied from interface:IWordget the entity name array of the word- Specified by:
getEntityin interfaceIWord- See Also:
IWord.getEntity()
-
getEntity
public String getEntity(int idx)
Description copied from interface:IWordget the specified entity by index- Specified by:
getEntityin interfaceIWord- See Also:
IWord.getEntity(int)
-
setEntity
public void setEntity(String[] entity)
Description copied from interface:IWordset the entity name array of the word- Specified by:
setEntityin interfaceIWord- See Also:
IWord.setEntity(String[])
-
setEntityForNull
public void setEntityForNull(String[] entity)
- Specified by:
setEntityForNullin interfaceIWord
-
addEntity
public void addEntity(String e)
Description copied from interface:IWordappend a new entity- Specified by:
addEntityin interfaceIWord- See Also:
IWord.addEntity(String)
-
getPinyin
public String getPinyin()
Description copied from interface:IWordreturn the pinyin of the word- Specified by:
getPinyinin interfaceIWord- See Also:
IWord.getPinyin()
-
setPinyin
public void setPinyin(String py)
Description copied from interface:IWordset the pinyin of the word- Specified by:
setPinyinin interfaceIWord- See Also:
IWord.setPinyin(String)
-
getSyn
public SynonymsEntry getSyn()
Description copied from interface:IWordreturn the Synonyms' entry of the word.- Specified by:
getSynin interfaceIWord- See Also:
IWord.getSyn()
-
setSyn
public void setSyn(SynonymsEntry syn)
-
getPartSpeech
public String[] getPartSpeech()
Description copied from interface:IWordreturn the part of speech of the word.- Specified by:
getPartSpeechin interfaceIWord- See Also:
IWord.getPartSpeech()
-
setPartSpeech
public void setPartSpeech(String[] partSpeech)
- Specified by:
setPartSpeechin interfaceIWord
-
setPartSpeechForNull
public void setPartSpeechForNull(String[] partSpeech)
- Specified by:
setPartSpeechForNullin interfaceIWord
-
addPartSpeech
public void addPartSpeech(String ps)
Description copied from interface:IWordadd a new part to speech to the word.- Specified by:
addPartSpeechin interfaceIWord- See Also:
IWord.addPartSpeech(String)
-
getParameter
public String getParameter()
Description copied from interface:IWordreturn the additional parameters- Specified by:
getParameterin interfaceIWord
-
setParameter
public void setParameter(String param)
Description copied from interface:IWordset the string parameters- Specified by:
setParameterin interfaceIWord
-
clone
public IWord clone()
Interface to clone the current object
-
equals
public boolean equals(Object o)
Description copied from interface:IWordyou have to rewrite the #equals method cause the Jcseg require it- Specified by:
equalsin interfaceIWord- Overrides:
equalsin classObject- See Also:
Object.equals(Object),IWord.equals(Object)
-
__toString
public String __toString()
for debug only
-
toString
public String toString()
- Overrides:
toStringin classObject- See Also:
Object.toString()
-
-