/// <summary> /// Initializes the resolvers used by this linker. /// </summary> /// <param name="mode"> /// The mode in which this linker is being used. /// </param> /// <param name="fixedNonReferentialProbability"> /// </param> protected internal virtual void InitializeResolvers(LinkerMode mode, double fixedNonReferentialProbability) { if (mode == LinkerMode.Train) { MentionFinder.PrenominalNamedEntitiesCollection = false; MentionFinder.CoordinatedNounPhrasesCollection = false; } SingularPronounIndex = 0; if (LinkerMode.Test == mode || LinkerMode.Eval == mode) { if (fixedNonReferentialProbability < 0) { Resolvers = new MaximumEntropyResolver[] { new SingularPronounResolver(CoreferenceProjectName, ResolverMode.Test), new ProperNounResolver(CoreferenceProjectName, ResolverMode.Test), new DefiniteNounResolver(CoreferenceProjectName, ResolverMode.Test), new IsAResolver(CoreferenceProjectName, ResolverMode.Test), new PluralPronounResolver(CoreferenceProjectName, ResolverMode.Test), new PluralNounResolver(CoreferenceProjectName, ResolverMode.Test), new CommonNounResolver(CoreferenceProjectName, ResolverMode.Test), new SpeechPronounResolver(CoreferenceProjectName, ResolverMode.Test) }; } else { INonReferentialResolver nrr = new FixedNonReferentialResolver(fixedNonReferentialProbability); Resolvers = new MaximumEntropyResolver[] { new SingularPronounResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new ProperNounResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new DefiniteNounResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new IsAResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new PluralPronounResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new PluralNounResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new CommonNounResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new SpeechPronounResolver(CoreferenceProjectName, ResolverMode.Test, nrr) }; } if (LinkerMode.Eval == mode) { //string[] names = {"Pronoun", "Proper", "Def-NP", "Is-a", "Plural Pronoun"}; //eval = new Evaluation(names); } MaximumEntropyResolver.SimilarityModel = SimilarityModel.TestModel(CoreferenceProjectName + "/sim"); } else if (LinkerMode.Train == mode) { Resolvers = new AbstractResolver[9]; Resolvers[0] = new SingularPronounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[1] = new ProperNounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[2] = new DefiniteNounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[3] = new IsAResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[4] = new PluralPronounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[5] = new PluralNounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[6] = new CommonNounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[7] = new SpeechPronounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[8] = new PerfectResolver(); } else { System.Console.Error.WriteLine("DefaultLinker: Invalid Mode"); } }
public TreebankLinker(string project, LinkerMode mode, bool useDiscourseModel, double fixedNonReferentialProbability) : base(project, mode, useDiscourseModel, fixedNonReferentialProbability) { }
public TreebankLinker(string project, LinkerMode mode, bool useDiscourseModel) : base(project, mode, useDiscourseModel) { }
public TreebankLinker(string project, LinkerMode mode) : base(project, mode) { }
/// <summary> /// Creates a new linker using the models in the specified project directory and using the specified mode. /// </summary> /// <param name="project"> /// The location of the models or other data needed by this linker. /// </param> /// <param name="mode"> /// The mode the linker should be run in: testing, training, or evaluation. /// </param> protected AbstractLinker(string project, LinkerMode mode) : this(project, mode, true) { }
/// <summary> /// Creates a new linker with the specified model directory, running in the specified mode which uses a discourse model /// based on the specified parameter. /// </summary> /// <param name="modelDirectory"> /// The directory where the models for this linker are kept. /// </param> /// <param name="mode"> /// The mode that this linker is running in. /// </param> /// <param name="useDiscourseModel"> /// Whether the model should use a discourse model or not. /// </param> public DefaultLinker(string modelDirectory, LinkerMode mode, bool useDiscourseModel) : this(modelDirectory, mode, useDiscourseModel, -1) { }
/// <summary> /// Creates a new linker with the specified model directory, running in the specified mode. /// </summary> /// <param name="modelDirectory"> /// The directory where the models for this linker are kept. /// </param> /// <param name="mode"> /// The mode that this linker is running in. /// </param> public DefaultLinker(string modelDirectory, LinkerMode mode) : this(modelDirectory, mode, true, -1) { }
/// <summary> /// Creates a new linker using the models in the specified project directory, using the specified mode, /// and combining coreferent entities based on the specified value. /// </summary> /// <param name="project"> /// The location of the models or other data needed by this linker. /// </param> /// <param name="mode"> /// The mode the linker should be run in: testing, training, or evaluation. /// </param> /// <param name="useDiscourseModel"> /// Specifies whether coreferent mention should be combined or not. /// </param> protected AbstractLinker(string project, LinkerMode mode, bool useDiscourseModel) { mCoreferenceProjectName = project; mMode = mode; mSingularPronounIndex = -1; mUseDiscourseModel = useDiscourseModel; mRemoveUnresolvedMentions = true; }
/// <summary> /// Initializes the resolvers used by this linker. /// </summary> /// <param name="mode"> /// The mode in which this linker is being used. /// </param> /// <param name="fixedNonReferentialProbability"> /// </param> protected internal virtual void InitializeResolvers(LinkerMode mode, double fixedNonReferentialProbability) { if (mode == LinkerMode.Train) { MentionFinder.PrenominalNamedEntitiesCollection = false; MentionFinder.CoordinatedNounPhrasesCollection = false; } SingularPronounIndex = 0; if (LinkerMode.Test == mode || LinkerMode.Eval == mode) { if (fixedNonReferentialProbability < 0) { Resolvers = new MaximumEntropyResolver[] { new SingularPronounResolver(CoreferenceProjectName, ResolverMode.Test), new ProperNounResolver(CoreferenceProjectName, ResolverMode.Test), new DefiniteNounResolver(CoreferenceProjectName, ResolverMode.Test), new IsAResolver(CoreferenceProjectName, ResolverMode.Test), new PluralPronounResolver(CoreferenceProjectName, ResolverMode.Test), new PluralNounResolver(CoreferenceProjectName, ResolverMode.Test), new CommonNounResolver(CoreferenceProjectName, ResolverMode.Test), new SpeechPronounResolver(CoreferenceProjectName, ResolverMode.Test) }; } else { INonReferentialResolver nrr = new FixedNonReferentialResolver(fixedNonReferentialProbability); Resolvers = new MaximumEntropyResolver[] { new SingularPronounResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new ProperNounResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new DefiniteNounResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new IsAResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new PluralPronounResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new PluralNounResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new CommonNounResolver(CoreferenceProjectName, ResolverMode.Test, nrr), new SpeechPronounResolver(CoreferenceProjectName, ResolverMode.Test, nrr) }; } if (LinkerMode.Eval == mode) { //String[] names = {"Pronoun", "Proper", "Def-NP", "Is-a", "Plural Pronoun"}; //eval = new Evaluation(names); } MaximumEntropyResolver.SimilarityModel = SimilarityModel.TestModel(CoreferenceProjectName + "/sim"); } else if (LinkerMode.Train == mode) { Resolvers = new AbstractResolver[9]; Resolvers[0] = new SingularPronounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[1] = new ProperNounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[2] = new DefiniteNounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[3] = new IsAResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[4] = new PluralPronounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[5] = new PluralNounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[6] = new CommonNounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[7] = new SpeechPronounResolver(CoreferenceProjectName, ResolverMode.Train); Resolvers[8] = new PerfectResolver(); } else { System.Console.Error.WriteLine("DefaultLinker: Invalid Mode"); } }
/// <summary> /// Creates a new linker with the specified model directory, running in the specified mode which uses a discourse model /// based on the specified parameter and uses the specified fixed non-referential probability. /// </summary> /// <param name="modelDirectory"> /// The directory where the models for this linker are kept. /// </param> /// <param name="mode"> /// The mode that this linker is running in. /// </param> /// <param name="useDiscourseModel"> /// Whether the model should use a discourse model or not. /// </param> /// <param name="fixedNonReferentialProbability"> /// The probability which resolvers are required to exceed to posit a coreference relationship. /// </param> public DefaultLinker(string modelDirectory, LinkerMode mode, bool useDiscourseModel, double fixedNonReferentialProbability) : base(modelDirectory, mode, useDiscourseModel) { if (mode != LinkerMode.Sim) { mCompatibilityModel = new MaximumEntropyCompatibilityModel(CoreferenceProjectName); } InitializeHeaderFinder(); InitializeMentionFinder(); if (mode != LinkerMode.Sim) { InitializeResolvers(mode, fixedNonReferentialProbability); Entities = new DiscourseEntity[Resolvers.Length]; } }