public class CodeSimplifier extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static int |
MAX |
protected boolean |
postSegmentation |
protected SimplifierRules |
ruleEvaluator |
protected String |
rules |
| Constructor and Description |
|---|
CodeSimplifier() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isPostSegmentation() |
void |
setPostSegmentation(boolean postSegmentation) |
void |
setRules(String rules) |
TextFragment[] |
simplifyAll(TextContainer tc,
boolean removeLeadingTrailingCodes,
boolean mergeCodes)
Simplifies all possible tags in a given possibly segmented text container.
|
TextFragment[] |
simplifyAll(TextFragment tf,
boolean removeLeadingTrailingCodes)
Simplifies all possible tags in a given text fragment.
|
TextFragment[] |
simplifyAll(TextFragment tf,
boolean removeLeadingTrailingCodes,
boolean mergeCodes)
Simplifies all possible tags in a given text fragment.
|
TextFragment[] |
simplifyAll(TextFragment tf,
int maxIterations,
boolean removeLeadingTrailingCodes,
boolean mergeCodes)
Simplifies all possible tags in a given text fragment.
|
void |
simplifyEmptyOpeningClosing(TextFragment tf) |
void |
simplifyIsolated(TextFragment tf)
Simplifies the place-holders in a given text fragment.
|
void |
simplifyOpeningClosing(TextFragment tf) |
protected static final int MAX
protected boolean postSegmentation
protected String rules
protected SimplifierRules ruleEvaluator
public TextFragment[] simplifyAll(TextFragment tf, int maxIterations, boolean removeLeadingTrailingCodes, boolean mergeCodes)
tf - the text fragment to modify.maxIterations - maximum number of iterations in merging of adjacent codes.removeLeadingTrailingCodes - true to remove the leading and/or the trailing codes
of the fragment and place their text in the result.
This works for isolated codes only for now.
It is the responsibility of the caller to put the leading/trailing data into the skeleton.mergeCodes - true to merge adjacent codes, false to leave as-ispublic TextFragment[] simplifyAll(TextContainer tc, boolean removeLeadingTrailingCodes, boolean mergeCodes)
tc - the given text container to modifyremoveLeadingTrailingCodes - true to remove the leading and/or the trailing code
of the fragment and place their text in the result.
It is the responsibility of the caller to put the leading/trailing data into the skeleton.mergeCodes - true to merge adjacent codes, false to leave as-is
original data of the codes removed. The first string if there was a leading code, the second string
if there was a trailing code. Both or either can be null.public TextFragment[] simplifyAll(TextFragment tf, boolean removeLeadingTrailingCodes, boolean mergeCodes)
tf - the text fragment to modify.removeLeadingTrailingCodes - true to remove the leading and/or the trailing code
of the fragment and place their text in the result.
It is the responsibility of the caller to put the leading/trailing data into the skeleton.mergeCodes - true to merge adjacent codes, false to leave as-ispublic TextFragment[] simplifyAll(TextFragment tf, boolean removeLeadingTrailingCodes)
tf - the text fragment to modify.removeLeadingTrailingCodes - true to remove the leading and/or the trailing code
of the fragment and place their text in the result.
It is the responsibility of the caller to put the leading/trailing data into the skeleton.public void simplifyIsolated(TextFragment tf)
tf - the text fragment to modify.public void simplifyOpeningClosing(TextFragment tf)
public void simplifyEmptyOpeningClosing(TextFragment tf)
public void setRules(String rules)
public boolean isPostSegmentation()
public void setPostSegmentation(boolean postSegmentation)
Copyright © 2022. All rights reserved.