Package org.apache.uima.ruta.resource

Examples of org.apache.uima.ruta.resource.RutaWordList


    String text = annotation.getCoveredText();
    if(arg != null) {
      text = arg.getStringValue(element.getParent(), annotation, stream);
    }
    if (stringList == null) {
      RutaWordList wordList = listExpr.getList(element.getParent());
      return new EvaluatedCondition(this, wordList.contains(text, false, 0, null, 0, true));
    }
    List<String> sList = stringList.getList(element.getParent(), stream);
    boolean contains = sList.contains(text);
    return new EvaluatedCondition(this, contains);
  }
View Full Code Here


    aliases.add(alias == null? "" : alias);
  }

  public RutaWordList getWordList(String list) {
    RutaWordList result = wordLists.get(list);
    if (result == null) {
      ResourceLoader resourceLoader = new RutaResourceLoader(getResourcePaths());
      Resource resource = resourceLoader.getResource(list);
      if (resource.exists()) {
        try {
View Full Code Here

        return be.getBooleanValue(owner, null, null);
      }
      if (clazz.equals(RutaWordList.class) && value instanceof LiteralWordListExpression) {
        LiteralWordListExpression lle = (LiteralWordListExpression) value;
        String path = lle.getText();
        RutaWordList wordList = getWordList(path);
        return wordList;
      } else if (clazz.equals(RutaWordList.class)) {
        RutaWordList list = getWordList((String) value);
        return list;
      } else if (clazz.equals(RutaTable.class) && value instanceof LiteralWordTableExpression) {
        LiteralWordTableExpression lte = (LiteralWordTableExpression) value;
        String path = lte.getText();
        RutaTable table = getWordTable(path);
View Full Code Here

    aliases.add(alias == null? "" : alias);
  }

  public RutaWordList getWordList(String list) {
    RutaWordList result = wordLists.get(list);
    if (result == null) {
      ResourceLoader resourceLoader = new RutaResourceLoader(getResourcePaths());
      Resource resource = resourceLoader.getResource(list);
      if (resource.exists()) {
        try {
View Full Code Here

        return be.getBooleanValue(owner, null, null);
      }
      if (clazz.equals(RutaWordList.class) && value instanceof LiteralWordListExpression) {
        LiteralWordListExpression lle = (LiteralWordListExpression) value;
        String path = lle.getText();
        RutaWordList wordList = getWordList(path);
        return wordList;
      } else if (clazz.equals(RutaWordList.class)) {
        RutaWordList list = getWordList((String) value);
        return list;
      } else if (clazz.equals(RutaTable.class) && value instanceof LiteralWordTableExpression) {
        LiteralWordTableExpression lte = (LiteralWordTableExpression) value;
        String path = lte.getText();
        RutaTable table = getWordTable(path);
View Full Code Here

    int ignoreLengthValue = ignoreLength.getIntegerValue(parent, match, element, stream);
    boolean editValue = edit.getBooleanValue(parent, match, element, stream);
    double distanceValue = distance.getDoubleValue(parent, match, element, stream);
    String ignoreCharValue = ignoreChar.getStringValue(parent, match, element, stream);

    RutaWordList wl = list.getList(parent);
    Collection<AnnotationFS> found = wl.find(stream, typeMap, ignoreCaseValue, ignoreLengthValue,
            editValue, distanceValue, ignoreCharValue);

    if (found != null) {
      for (AnnotationFS annotation : found) {
        stream.addAnnotation(annotation, match);
View Full Code Here

  @Override
  public void execute(RuleMatch match, RuleElement element, RutaStream stream, InferenceCrowd crowd) {
    List<AnnotationFS> matchedAnnotationsOf = match.getMatchedAnnotationsOf(element);
    for (AnnotationFS annotationFS : matchedAnnotationsOf) {
      RutaStream windowStream = stream.getWindowStream(annotationFS, annotationFS.getType());
      RutaWordList wl = null;
      RutaBlock parent = element.getParent();
      if (list != null) {
        wl = list.getList(parent);
      } else if (stringList != null) {
        wl = new TreeWordList(stringList.getList(parent, stream));
      }
      if (wl instanceof TreeWordList) {
        Collection<AnnotationFS> found = wl.find(windowStream,
                ignore.getBooleanValue(parent, match, element, stream),
                ignoreLength.getIntegerValue(parent, match, element, stream), null, 0,
                ignoreWS.getBooleanValue(parent, match, element, stream));
        for (AnnotationFS annotation : found) {
          createAnnotation(annotation, element, windowStream, match);
View Full Code Here

    return result.replaceAll("\\\\\\\"", "\\\"");
  }

  @Override
  public RutaWordList getList(RutaStatement element) {
    RutaWordList list = element.getEnvironment().getWordList(getText());
    return list;
  }
View Full Code Here

    }
    if(text == null) {
      return new EvaluatedCondition(this, false);
    }
    if (stringList == null) {
      RutaWordList wordList = listExpr.getList(element.getParent());
      return new EvaluatedCondition(this, wordList.contains(text, false, 0, null, 0, true));
    }
    List<String> sList = stringList.getList(element.getParent(), stream);
    boolean contains = sList.contains(text);
    return new EvaluatedCondition(this, contains);
  }
View Full Code Here

    String ignoreCharValue = ignoreChar != null ? ignoreChar.getStringValue(element.getParent(),
            null, stream) : "";
    int maxIgnoreCharValue = maxIgnoreChar != null ? maxIgnoreChar.getIntegerValue(
            element.getParent(), null, stream) : 0;

    RutaWordList wordList = table.getWordList(index);
    Collection<AnnotationFS> found = wordList.find(stream, ignoreCaseValue, ignoreLengthValue,
            ignoreCharValue.toCharArray(), maxIgnoreCharValue, true);
    for (AnnotationFS annotationFS : found) {
      List<String> rowWhere = table.getRowWhere(index - 1, annotationFS.getCoveredText());
      FeatureStructure newFS = stream.getCas().createFS(type);
      if (newFS instanceof Annotation) {
View Full Code Here

TOP

Related Classes of org.apache.uima.ruta.resource.RutaWordList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.