sg.edu.nus.comp.nlp.ims.feature
Class CCollocationExtractor

java.lang.Object
  extended by sg.edu.nus.comp.nlp.ims.feature.CCollocationExtractor
All Implemented Interfaces:
IFeatureExtractor

public class CCollocationExtractor
extends java.lang.Object
implements IFeatureExtractor

collocation extractor.

Author:
zhongzhi

Field Summary
protected static int g_TIDX
           
protected  java.util.ArrayList<java.lang.Integer> m_Begins
           
protected  int m_CollocationIndex
           
protected  ICorpus m_Corpus
           
protected  IFeature m_CurrentFeature
           
protected  java.util.ArrayList<java.lang.Integer> m_Ends
           
protected  int m_Index
           
protected  int m_IndexInSentence
           
protected  int m_InstanceLength
           
protected  ISentence m_Sentence
           
 
Constructor Summary
CCollocationExtractor()
          default constructor
CCollocationExtractor(java.util.ArrayList<java.lang.Integer> p_Begins, java.util.ArrayList<java.lang.Integer> p_Ends)
          constructor
 
Method Summary
protected  java.lang.String formCollocationName(int p_Begin, int p_End)
          form collocation name
protected  java.lang.String getCollocation(int p_Begin, int p_End)
          get collocation
 java.lang.String getCurrentInstanceID()
          get the ID of current instance to be extracted
protected  IFeature getNext()
          get the next feature of current instance
 boolean hasNext()
          whether has at least one more feature
 IFeature next()
          get the next feature
 boolean restart()
          restart the iterator
 boolean setCorpus(ICorpus p_Corpus)
          set corpus to be extracted
 boolean setCurrentInstance(int p_Index)
          set the index of instance which to be extracted from corpus
protected  boolean validIndex(int p_Index)
          check the validity of index
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_Begins

protected java.util.ArrayList<java.lang.Integer> m_Begins

m_Ends

protected java.util.ArrayList<java.lang.Integer> m_Ends

m_Corpus

protected ICorpus m_Corpus

m_CurrentFeature

protected IFeature m_CurrentFeature

m_CollocationIndex

protected int m_CollocationIndex

m_Index

protected int m_Index

m_Sentence

protected ISentence m_Sentence

m_IndexInSentence

protected int m_IndexInSentence

m_InstanceLength

protected int m_InstanceLength

g_TIDX

protected static int g_TIDX
Constructor Detail

CCollocationExtractor

public CCollocationExtractor()
default constructor


CCollocationExtractor

public CCollocationExtractor(java.util.ArrayList<java.lang.Integer> p_Begins,
                             java.util.ArrayList<java.lang.Integer> p_Ends)
constructor

Parameters:
p_Begins - collocation begins
p_Ends - collocation ends
Method Detail

validIndex

protected boolean validIndex(int p_Index)
check the validity of index

Parameters:
p_Index - index
Returns:
valid or not

getCurrentInstanceID

public java.lang.String getCurrentInstanceID()
Description copied from interface: IFeatureExtractor
get the ID of current instance to be extracted

Specified by:
getCurrentInstanceID in interface IFeatureExtractor
Returns:
instance id

hasNext

public boolean hasNext()
Description copied from interface: IFeatureExtractor
whether has at least one more feature

Specified by:
hasNext in interface IFeatureExtractor
Returns:
has or not

formCollocationName

protected java.lang.String formCollocationName(int p_Begin,
                                               int p_End)
form collocation name

Parameters:
p_Begin - collocation beginning index
p_End - collocation ending index
Returns:
feature name

getCollocation

protected java.lang.String getCollocation(int p_Begin,
                                          int p_End)
get collocation

Parameters:
p_Begin - collocation beginning index
p_End - collocation ending index
Returns:
feature value

getNext

protected IFeature getNext()
get the next feature of current instance

Returns:
feature

next

public IFeature next()
Description copied from interface: IFeatureExtractor
get the next feature

Specified by:
next in interface IFeatureExtractor
Returns:
feature

restart

public boolean restart()
Description copied from interface: IFeatureExtractor
restart the iterator

Specified by:
restart in interface IFeatureExtractor
Returns:
success or not

setCorpus

public boolean setCorpus(ICorpus p_Corpus)
Description copied from interface: IFeatureExtractor
set corpus to be extracted

Specified by:
setCorpus in interface IFeatureExtractor
Parameters:
p_Corpus - corpus to be extracted
Returns:
set success or not

setCurrentInstance

public boolean setCurrentInstance(int p_Index)
Description copied from interface: IFeatureExtractor
set the index of instance which to be extracted from corpus

Specified by:
setCurrentInstance in interface IFeatureExtractor
Parameters:
p_Index - instance index
Returns:
set success or not