コード例 #1
0
 public CorefAnnotator(Properties props)
 {
     this.props = props;
     try
     {
         // if user tries to run with coref.language = ENGLISH and coref.algorithm = hybrid, throw Exception
         // we do not support those settings at this time
         if (CorefProperties.Algorithm(props).Equals(CorefProperties.CorefAlgorithmType.Hybrid) && CorefProperties.GetLanguage(props).Equals(Locale.English))
         {
             log.Error("Error: coref.algorithm=hybrid is not supported for English, " + "please change coref.algorithm or coref.language");
             throw new Exception();
         }
         // suppress
         props.SetProperty("coref.printConLLLoadingMessage", "false");
         corefSystem = new CorefSystem(props);
         props.Remove("coref.printConLLLoadingMessage");
     }
     catch (Exception e)
     {
         log.Error("Error creating CorefAnnotator...terminating pipeline construction!");
         log.Error(e);
         throw new Exception(e);
     }
     // unless custom mention detection is set, just use the default coref mention detector
     performMentionDetection = !PropertiesUtils.GetBool(props, "coref.useCustomMentionDetection", false);
     if (performMentionDetection)
     {
         mentionAnnotator = new CorefMentionAnnotator(props);
     }
 }
コード例 #2
0
 public DeterministicCorefAnnotator(Properties props)
 {
     // for backward compatibility
     try
     {
         corefSystem      = new SieveCoreferenceSystem(props);
         mentionExtractor = new MentionExtractor(corefSystem.Dictionaries(), corefSystem.Semantics());
         OldFormat        = bool.Parse(props.GetProperty("oldCorefFormat", "false"));
         allowReparsing   = PropertiesUtils.GetBool(props, Constants.AllowReparsingProp, Constants.AllowReparsing);
         // unless custom mention detection is set, just use the default coref mention detector
         performMentionDetection = !PropertiesUtils.GetBool(props, "dcoref.useCustomMentionDetection", false);
         if (performMentionDetection)
         {
             mentionAnnotator = new CorefMentionAnnotator(props);
         }
     }
     catch (Exception e)
     {
         log.Error("cannot create DeterministicCorefAnnotator!");
         log.Error(e);
         throw new Exception(e);
     }
 }