本文整理了Java中org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation.getPolarity()
方法的一些代码示例,展示了IdentifiedAnnotation.getPolarity()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IdentifiedAnnotation.getPolarity()
方法的具体详情如下:
包路径:org.apache.ctakes.typesystem.type.textsem.IdentifiedAnnotation
类名称:IdentifiedAnnotation
方法名:getPolarity
[英]getter for polarity - gets
[中]极性getter-get
代码示例来源:origin: apache/tika
String polarity_pref = "POLARITY";
value = new StringBuilder(polarity_pref).append("=").
append(Integer.toString(annotation.getPolarity())).toString();
代码示例来源:origin: org.apache.ctakes/ctakes-coreference
public boolean calcNegatedBoth(){
if((a1 instanceof EntityMention && a2 instanceof EntityMention) || (a1 instanceof EventMention && a2 instanceof EventMention)){
if(((IdentifiedAnnotation)a1).getPolarity() == -1 &&
((IdentifiedAnnotation)a2).getPolarity() == -1){
return true;
}
}
return false;
}
代码示例来源:origin: org.apache.ctakes/ctakes-coreference
public boolean calcNonNegatedBoth(){
if(a1 instanceof EntityMention && a2 instanceof EntityMention || (a1 instanceof EventMention && a2 instanceof EventMention)){
if(((IdentifiedAnnotation)a1).getPolarity() == 1.0 &&
((IdentifiedAnnotation)a2).getPolarity() == 1.0){
return true;
}
}
return false;
}
代码示例来源:origin: apache/ctakes
public boolean calcNegatedBoth(){
if((a1 instanceof EntityMention && a2 instanceof EntityMention) || (a1 instanceof EventMention && a2 instanceof EventMention)){
if(((IdentifiedAnnotation)a1).getPolarity() == -1 &&
((IdentifiedAnnotation)a2).getPolarity() == -1){
return true;
}
}
return false;
}
代码示例来源:origin: apache/ctakes
public boolean calcNonNegatedBoth(){
if(a1 instanceof EntityMention && a2 instanceof EntityMention || (a1 instanceof EventMention && a2 instanceof EventMention)){
if(((IdentifiedAnnotation)a1).getPolarity() == 1.0 &&
((IdentifiedAnnotation)a2).getPolarity() == 1.0){
return true;
}
}
return false;
}
代码示例来源:origin: org.apache.ctakes/ctakes-coreference
public static boolean isNegated(IdentifiedAnnotation mention){
return mention.getPolarity() == CONST.NE_POLARITY_NEGATION_PRESENT;
}
代码示例来源:origin: apache/ctakes
public static boolean isNegated(IdentifiedAnnotation mention){
return mention.getPolarity() == CONST.NE_POLARITY_NEGATION_PRESENT;
}
代码示例来源:origin: org.apache.ctakes/ctakes-assertion
@Override
public List<Feature> extract(JCas view, IdentifiedAnnotation focusAnnotation)
throws CleartkExtractorException {
List<Feature> featList = new ArrayList<>();
IdentifiedAnnotation mention = focusAnnotation;
featList.add(new Feature("IsNegated", mention.getPolarity() == CONST.NE_POLARITY_NEGATION_PRESENT));
return featList;
}
代码示例来源:origin: apache/ctakes
@Override
public List<Feature> extract(JCas view, IdentifiedAnnotation focusAnnotation)
throws CleartkExtractorException {
List<Feature> featList = new ArrayList<>();
IdentifiedAnnotation mention = focusAnnotation;
featList.add(new Feature("IsNegated", mention.getPolarity() == CONST.NE_POLARITY_NEGATION_PRESENT));
return featList;
}
代码示例来源:origin: org.apache.ctakes/ctakes-core
static private Collection<String> createPolarity( final IdentifiedAnnotation annotation ) {
final Collection<String> tags = new ArrayList<>();
if ( annotation.getPolarity() < 0 ) {
if ( annotation.getUncertainty() > 0 ) {
tags.add( "uncertainnegated" );
} else {
tags.add( "negated" );
}
} else if ( annotation.getUncertainty() > 0 ) {
tags.add( "uncertain" );
} else {
tags.add( "affirmed" );
}
return tags;
}
代码示例来源:origin: apache/ctakes
static private String createBsvLine( final IdentifiedAnnotation annotation,
final UmlsConcept concept,
final String locationCuis ) {
final StringBuilder sb = new StringBuilder();
sb.append( concept.getCode() ).append( '|' )
.append( concept.getPreferredText() ).append( '|' )
.append( SemanticTui.getTuiFromCode( concept.getTui() ).getGroupName() ).append( '|' )
.append( annotation.getPolarity() == CONST.NE_POLARITY_NEGATION_PRESENT ? "true" : "false" ).append( '|' )
.append( annotation.getSubject().equals( CONST.ATTR_SUBJECT_FAMILY_MEMBER ) ? "true" : "false" ).append( '|' )
.append( locationCuis ).append( '|' )
.append( annotation.getCoveredText() );
return sb.toString();
}
代码示例来源:origin: apache/ctakes
static private String getAssertion( final IdentifiedAnnotation annotation ) {
final StringBuilder sb = new StringBuilder();
if ( annotation.getPolarity() == CONST.NE_POLARITY_NEGATION_PRESENT ) {
sb.append( "AFFIRMED" );
} else {
sb.append( "NEGATED" );
}
if ( annotation.getUncertainty() == CONST.NE_UNCERTAINTY_PRESENT ) {
sb.append( "UNCERTAIN" );
}
if ( annotation.getGeneric() ) {
sb.append( "GENERIC" );
}
if ( annotation.getConditional() ) {
sb.append( "CONDITIONAL" );
}
return sb.toString();
}
代码示例来源:origin: org.apache.ctakes/ctakes-clinical-pipeline
@Override
protected String extractInformation(IdentifiedAnnotation t) {
StringBuilder buff = new StringBuilder();
FSArray mentions = t.getOntologyConceptArr();
HashSet<String> uniqueCuis = new HashSet<String>();
if(mentions == null) return null;
for(int i = 0; i < mentions.size(); i++){
if(mentions.get(i) instanceof UmlsConcept){
UmlsConcept concept = (UmlsConcept) mentions.get(i);
uniqueCuis.add(concept.getCui());
}
}
for(String cui : uniqueCuis){
if(t.getPolarity() == CONST.NE_POLARITY_NEGATION_PRESENT) buff.append("-");
buff.append(cui);
buff.append("\n");
}
if(buff.length() == 0) return null;
return buff.substring(0,buff.length()-1);
}
/**
代码示例来源:origin: apache/ctakes
private String getAttrValueString(IdentifiedAnnotation mention, Selector s) {
switch (s) {
case CONDITIONAL:
return String.valueOf(mention.getConditional());
case GENERIC:
return String.valueOf(mention.getGeneric());
case HISTORYOF:
return String.valueOf(mention.getHistoryOf());
case POLARITY:
return String.valueOf(mention.getPolarity());
case SUBJECT:
return String.valueOf(mention.getSubject());
case UNCERTAINTY:
return String.valueOf(mention.getUncertainty());
default:
return "?";
}
}
代码示例来源:origin: org.apache.ctakes/ctakes-assertion
private String getAttrValueString(IdentifiedAnnotation mention, Selector s) {
switch (s) {
case CONDITIONAL:
return String.valueOf(mention.getConditional());
case GENERIC:
return String.valueOf(mention.getGeneric());
case HISTORYOF:
return String.valueOf(mention.getHistoryOf());
case POLARITY:
return String.valueOf(mention.getPolarity());
case SUBJECT:
return String.valueOf(mention.getSubject());
case UNCERTAINTY:
return String.valueOf(mention.getUncertainty());
default:
return "?";
}
}
代码示例来源:origin: apache/ctakes
/**
* @param annotation -
* @return polarity for a single annotation
*/
static private String createPolarity( final IdentifiedAnnotation annotation ) {
if ( annotation instanceof TimeMention || annotation instanceof EntityMention ) {
return GENERIC;
}
if ( annotation.getPolarity() < 0 ) {
if ( annotation.getUncertainty() > 0 ) {
return UNCERTAIN_NEGATED;
} else {
return NEGATED;
}
} else if ( annotation.getUncertainty() > 0 ) {
return UNCERTAIN;
} else {
return AFFIRMED;
}
}
代码示例来源:origin: apache/ctakes
/**
* @param annotation -
* @return polarity for a single annotation
*/
static private String createPolarity( final IdentifiedAnnotation annotation ) {
if ( annotation instanceof TimeMention || annotation instanceof EntityMention ) {
return GENERIC;
}
if ( annotation.getPolarity() < 0 ) {
if ( annotation.getUncertainty() > 0 ) {
return UNCERTAIN_NEGATED;
} else {
return NEGATED;
}
} else if ( annotation.getUncertainty() > 0 ) {
return UNCERTAIN;
} else {
return AFFIRMED;
}
}
代码示例来源:origin: org.apache.ctakes/ctakes-assertion
private void printContext(String text, IdentifiedAnnotation mention, int radius) {
int mentionBegin = mention.getBegin();
int mentionEnd = mention.getEnd();
StringBuilder sb = new StringBuilder();
int snipBegin;
int snipEnd;
snipBegin = (mentionBegin-radius<0)? 0 : mentionBegin-radius;
snipEnd = (mentionEnd+radius>text.length()-1)? text.length()-1 : mentionEnd+radius;
String[] tmp = mention.getClass().getName().split("\\.");
String semGroup = tmp[tmp.length-1];
sb.append(text.substring(snipBegin, mentionBegin));
sb.append("[[["+mention.getCoveredText()+"]]]");
sb.append(text.substring(mentionEnd, snipEnd));
// sb.toString().replaceAll("\\n", "\\n| ");
System.out.println("| "+ sb.toString().replaceAll("\\n", "\n| "));
System.out.println(": "+ semGroup +
" : beg=" + mention.getBegin() + " : end=" + mention.getEnd() +
" : c=" + mention.getConditional() + " : g=" + mention.getGeneric() +
" : h=" + mention.getHistoryOf() + " : p=" + mention.getPolarity() +
" : s=" + mention.getSubject() + " : u=" + mention.getUncertainty());
}
代码示例来源:origin: org.apache.ctakes/ctakes-core
private Entity( final IdentifiedAnnotation annotation ) {
_begin = annotation.getBegin();
_end = annotation.getEnd();
_coveredText = annotation.getCoveredText();
_polarity = annotation.getPolarity();
_uncertainty = annotation.getUncertainty();
_conditional = annotation.getConditional();
_generic = annotation.getGeneric();
_subject = annotation.getSubject();
_historyOf = annotation.getHistoryOf();
}
代码示例来源:origin: apache/ctakes
private Entity( final IdentifiedAnnotation annotation ) {
_begin = annotation.getBegin();
_end = annotation.getEnd();
_coveredText = annotation.getCoveredText();
_polarity = annotation.getPolarity();
_uncertainty = annotation.getUncertainty();
_conditional = annotation.getConditional();
_generic = annotation.getGeneric();
_subject = annotation.getSubject();
_historyOf = annotation.getHistoryOf();
}
内容来源于网络,如有侵权,请联系作者删除!