17 using System.Collections.Generic;
18 using System.ComponentModel;
19 using TraceLab.Components.DevelopmentKit.Preprocessors;
21 using TraceLabSDK.Component.Config;
22 using TraceLabSDK.Types;
24 namespace TraceLab.Components.Library.Preprocessors
26 [Component(Name =
"Part-of-speech Extractor",
27 Description =
"Extracts terms from a TLArtifactsCollection based on the part of speech specified. Uses the Stanford NLP POS-tagger.",
28 Author =
"SEMERU; Evan Moritz",
31 [IOSpec(IOSpecType.Input,
"ListOfArtifacts", typeof(TLArtifactsCollection))]
32 [IOSpec(IOSpecType.Output,
"ListOfArtifacts", typeof(TLArtifactsCollection))]
33 [Tag(
"Preprocessors")]
42 Configuration = _config;
47 Logger.Trace(
"Starting POSExtractor. This may take awhile (especially the bidirectional models)....");
48 TLArtifactsCollection artifacts = (TLArtifactsCollection)Workspace.Load(
"ListOfArtifacts");
50 TLArtifactsCollection extracted =
new TLArtifactsCollection();
52 foreach (KeyValuePair<string, TLArtifact> artifactKVP
in artifacts)
55 Logger.Trace(
"Extracted " + count +
"/" + artifacts.Count);
58 Workspace.Store(
"ListOfArtifacts", extracted);
64 [DisplayName(
"Part of Speech")]
65 [Description(
"The desired part of speech for extraction.")]
68 [DisplayName(
"Training Model")]
69 [Description(
"The training model used to tag the parts of speech.")]
70 public FilePath ModelFile {
get; set; }