use of com.joliciel.talismane.posTagger.PosTaggedToken in project talismane by joliciel-informatique.
the class AddressFunctionBuffer method check.
@Override
public FeatureResult<PosTaggedTokenWrapper> check(ParseConfigurationWrapper wrapper, RuntimeEnvironment env) throws TalismaneException {
ParseConfiguration configuration = wrapper.getParseConfiguration();
PosTaggedToken resultToken = null;
FeatureResult<Integer> indexResult = indexFeature.check(configuration, env);
if (indexResult != null) {
int index = indexResult.getOutcome();
Iterator<PosTaggedToken> bufferIterator = configuration.getBuffer().iterator();
for (int i = 0; i <= index; i++) {
if (!bufferIterator.hasNext()) {
resultToken = null;
break;
}
resultToken = bufferIterator.next();
}
}
FeatureResult<PosTaggedTokenWrapper> featureResult = null;
if (resultToken != null)
featureResult = this.generateResult(resultToken);
return featureResult;
}
use of com.joliciel.talismane.posTagger.PosTaggedToken in project talismane by joliciel-informatique.
the class AddressFunctionHead method check.
@Override
public FeatureResult<PosTaggedTokenWrapper> check(ParseConfigurationWrapper wrapper, RuntimeEnvironment env) throws TalismaneException {
ParseConfiguration configuration = wrapper.getParseConfiguration();
PosTaggedToken resultToken = null;
FeatureResult<PosTaggedTokenWrapper> addressResult = addressFunction.check(wrapper, env);
if (addressResult != null) {
PosTaggedToken referenceToken = addressResult.getOutcome().getPosTaggedToken();
resultToken = configuration.getHead(referenceToken);
}
FeatureResult<PosTaggedTokenWrapper> featureResult = null;
if (resultToken != null)
featureResult = this.generateResult(resultToken);
return featureResult;
}
use of com.joliciel.talismane.posTagger.PosTaggedToken in project talismane by joliciel-informatique.
the class AddressFunctionLDep method check.
@Override
public FeatureResult<PosTaggedTokenWrapper> check(ParseConfigurationWrapper wrapper, RuntimeEnvironment env) throws TalismaneException {
ParseConfiguration configuration = wrapper.getParseConfiguration();
PosTaggedToken resultToken = null;
FeatureResult<PosTaggedTokenWrapper> addressResult = addressFunction.check(wrapper, env);
if (addressResult != null) {
PosTaggedToken referenceToken = addressResult.getOutcome().getPosTaggedToken();
List<PosTaggedToken> leftDependents = configuration.getLeftDependents(referenceToken);
if (leftDependents.size() > 0)
resultToken = leftDependents.get(0);
}
FeatureResult<PosTaggedTokenWrapper> featureResult = null;
if (resultToken != null)
featureResult = this.generateResult(resultToken);
return featureResult;
}
use of com.joliciel.talismane.posTagger.PosTaggedToken in project talismane by joliciel-informatique.
the class AddressFunctionOffset method check.
@Override
public FeatureResult<PosTaggedTokenWrapper> check(ParseConfigurationWrapper wrapper, RuntimeEnvironment env) throws TalismaneException {
ParseConfiguration configuration = wrapper.getParseConfiguration();
PosTaggedToken resultToken = null;
FeatureResult<PosTaggedTokenWrapper> addressResult = addressFunction.check(wrapper, env);
FeatureResult<Integer> offsetResult = offsetFeature.check(configuration, env);
if (addressResult != null && offsetResult != null) {
int offset = offsetResult.getOutcome();
PosTaggedToken referenceToken = addressResult.getOutcome().getPosTaggedToken();
int refIndex = referenceToken.getToken().getIndex();
int index = refIndex + offset;
if (index >= 0 && index < configuration.getPosTagSequence().size()) {
resultToken = configuration.getPosTagSequence().get(index);
}
}
FeatureResult<PosTaggedTokenWrapper> featureResult = null;
if (resultToken != null)
featureResult = this.generateResult(resultToken);
return featureResult;
}
use of com.joliciel.talismane.posTagger.PosTaggedToken in project talismane by joliciel-informatique.
the class AddressFunctionSequence method check.
@Override
public FeatureResult<PosTaggedTokenWrapper> check(ParseConfigurationWrapper wrapper, RuntimeEnvironment env) throws TalismaneException {
ParseConfiguration configuration = wrapper.getParseConfiguration();
PosTaggedToken resultToken = null;
FeatureResult<Integer> indexResult = indexFeature.check(configuration, env);
if (indexResult != null) {
int index = indexResult.getOutcome();
if (index >= 0 && index < configuration.getPosTagSequence().size())
resultToken = configuration.getPosTagSequence().get(index);
}
FeatureResult<PosTaggedTokenWrapper> featureResult = null;
if (resultToken != null)
featureResult = this.generateResult(resultToken);
return featureResult;
}
Aggregations