Package com.clearnlp.propbank

Examples of com.clearnlp.propbank.PBInstance


  void checkMisalignedArgs(String[] args)
  {
    MultiFrames frames = new MultiFrames(args[0]);
    PBReader reader = new PBReader(UTInput.createBufferedFileReader(args[1]));
    int invalid = 0, total = 0;
    PBInstance instance;
    PBRoleset  roleset;
    String type;
   
    while ((instance = reader.nextInstance()) != null)
    {
      type = instance.type;
     
      if (type.endsWith(PBType.VERB.getValue()))
      {
        roleset = frames.getRoleset(PBType.VERB, type.substring(0,type.length()-2), instance.roleset);
        total++;
       
        if (roleset != null)
        {
          for (PBArg arg : instance.getArgs())
          {
            if (!roleset.isValidArgument(arg.label))
            {
              System.out.println(instance.toString());
              invalid++;
              break;
            }
          }
        }
View Full Code Here


  void checkMisalignedArgs(String[] args)
  {
    MultiFrames frames = new MultiFrames(args[0]);
    PBReader reader = new PBReader(UTInput.createBufferedFileReader(args[1]));
    int invalid = 0, total = 0;
    PBInstance instance;
    PBRoleset  roleset;
    String type;
   
    while ((instance = reader.nextInstance()) != null)
    {
      type = instance.type;
     
      if (type.endsWith(PBType.VERB.getValue()))
      {
        roleset = frames.getRoleset(PBType.VERB, type.substring(0,type.length()-2), instance.roleset);
        total++;
       
        if (roleset != null)
        {
          for (PBArg arg : instance.getArgs())
          {
            if (!roleset.isValidArgument(arg.label))
            {
              System.out.println(instance.toString());
              invalid++;
              break;
            }
          }
        }
View Full Code Here

  void checkMisalignedArgs(String[] args)
  {
    MultiFrames frames = new MultiFrames(args[0]);
    PBReader reader = new PBReader(UTInput.createBufferedFileReader(args[1]));
    int invalid = 0, total = 0;
    PBInstance instance;
    PBRoleset  roleset;
    String type;
   
    while ((instance = reader.nextInstance()) != null)
    {
      type = instance.type;
     
      if (type.endsWith(PBType.VERB.getValue()))
      {
        roleset = frames.getRoleset(PBType.VERB, type.substring(0,type.length()-2), instance.roleset);
        total++;
       
        if (roleset != null)
        {
          for (PBArg arg : instance.getArgs())
          {
            if (!roleset.isValidArgument(arg.label))
            {
              System.out.println(instance.toString());
              invalid++;
              break;
            }
          }
        }
View Full Code Here

  private void mergeLightVerbs(List<PBInstance> instances)
  {
    Map<String,PBInstance> mNouns = new HashMap<String,PBInstance>();
    List<PBInstance> lVerbs = new ArrayList<PBInstance>();
    List<PBInstance> remove = new ArrayList<PBInstance>();
    PBInstance nInst;
    List<PBArg> args;
    PBArg rel;
   
    for (PBInstance instance : instances)
    {
      if (instance.isVerbPredicate())
      {
        if (instance.roleset.endsWith("LV"))
          lVerbs.add(instance);
      }
      else
        mNouns.put(instance.getKey(), instance);
    }
   
    for (PBInstance instance : lVerbs)
    {
      nInst = null;
      args  = new ArrayList<PBArg>();
     
      for (PBArg arg : instance.getArgs())
      {
        if (arg.label.endsWith("PRR"))
          nInst = mNouns.get(instance.getKey(arg.getLoc(0).terminalId));
        else if (arg.label.startsWith("LINK") || arg.isLabel(PBLib.PB_ARG0))
          args.add(arg);
      }
     
      if (nInst == null)
      {
        StringBuilder build = new StringBuilder();
       
        build.append(ERR_LV);
        build.append(":");
        build.append(" ");
        build.append(instance.toString());
       
        System.err.println(build.toString());
        remove.add(instance);
      }
      else
      {
        nInst.addArgs(args);
        rel = nInst.getFirstArg(PBLib.PB_REL);
        rel.addLoc(new PBLoc(instance.predId, 0, ","));
       
        args.clear();
       
        for (PBArg arg : instance.getArgs())
View Full Code Here

TOP

Related Classes of com.clearnlp.propbank.PBInstance

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.