Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
  public PredicateArgumentExtractor(JCas jCas) {
    this. = ArrayListMultimap.create();
    for (Predicate predicate : {
      for (BaseToken token : JCasUtil.selectCovered(jCasBaseToken.classpredicate)) {
    this. = ArrayListMultimap.create();
    for (SemanticArgument argument : {
      for (BaseToken token : JCasUtil.selectCovered(jCasBaseToken.classargument)) {
  public List<Feature> extract(BaseToken token) {
    List<Feature> features = Lists.newArrayList();
    Collection<Predicatepredicates = this..get(token);
    features.add(new Feature("Predicate", !predicates.isEmpty()));
    for (Predicate predicate : predicates) {
      features.add(new Feature("Predicate_Lex"predicate.getCoveredText()));
    for (SemanticArgument argument : this..get(token)) {
      SemanticRoleRelation relation = argument.getRelation();
      String category = relation.getCategory();
      features.add(new Feature("Argument"category));
      String predicateText = relation.getPredicate().getCoveredText();
      features.add(new Feature("Argument_Lex", String.format("%s_%s"categorypredicateText)));
    return features;
New to GrepCode? Check out our FAQ X