├── .gitattributes
├── .gitignore
├── ConsoleApp1
├── ConsoleApp1.xproj
├── Program.cs
├── project.json
└── project.lock.json
├── ConsoleApplication1
├── App.config
├── ConsoleApplication1.csproj
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── ConsoleApplication2
├── App.config
├── ConsoleApplication2.csproj
├── Program.cs
└── Properties
│ └── AssemblyInfo.cs
├── Lithium
├── AssemblyInfo.cs
├── Collections
│ ├── ConnectionCollection.cs
│ └── ShapeCollection.cs
├── Connection.cs
├── Delegates
│ └── Delegates.cs
├── Entity.cs
├── Enums
│ └── Enums.cs
├── GraphAbstract.cs
├── IO
│ ├── DataType.cs
│ ├── EdgeType.cs
│ ├── GraphDataAttribute.cs
│ ├── GraphDataCollection.cs
│ ├── GraphSerializer.cs
│ ├── GraphType.cs
│ ├── NodeType.cs
│ ├── ParentChild.cs
│ └── ParentChildCollection.cs
├── Interfaces
│ └── Interfaces.cs
├── Lithium.csproj
├── LithiumControl.bmp
├── Proxy.cs
├── ShapeBase.cs
├── Shapes
│ ├── OvalShape.cs
│ ├── SimpleRectangle.cs
│ └── TextLabel.cs
├── UI
│ ├── LithiumControl.cs
│ └── LithiumControl.resx
├── Visitors
│ ├── DeleteVisitor.cs
│ └── ExpanderVisitor.cs
├── app.config
└── packages.config
├── ModelConverter
├── App.ico
├── AssemblyInfo.cs
├── Converter.cs
├── ModelConverter.csproj
├── app.config
└── packages.config
├── OpenNLP.sln
├── OpenNLP
├── AssemblyInfo.cs
├── OpenNLP.csproj
├── Properties
│ ├── Resources.Designer.cs
│ └── Resources.resx
├── Resources
│ └── EnglishChunk.nbin
├── Tools
│ ├── Chunker
│ │ ├── ChunkerEventReader.cs
│ │ ├── DefaultChunkerContextGenerator.cs
│ │ ├── EnglishTreebankChunker.cs
│ │ ├── IChunker.cs
│ │ ├── IChunkerContextGenerator.cs
│ │ └── MaximumEntropyChunker.cs
│ ├── Coreference
│ │ ├── AbstractLinker.cs
│ │ ├── DefaultLinker.cs
│ │ ├── DiscourseElement.cs
│ │ ├── DiscourseEntity.cs
│ │ ├── DiscourseModel.cs
│ │ ├── ILinker.cs
│ │ ├── LinkerMode.cs
│ │ ├── Mention
│ │ │ ├── AbstractMentionFinder.cs
│ │ │ ├── AbstractParse.cs
│ │ │ ├── DefaultParse.cs
│ │ │ ├── DictionaryFactory.cs
│ │ │ ├── IDictionary.cs
│ │ │ ├── IHeadFinder.cs
│ │ │ ├── IMentionFinder.cs
│ │ │ ├── IParse.cs
│ │ │ ├── JWNLDictionary.cs
│ │ │ ├── Mention.cs
│ │ │ ├── MentionContext.cs
│ │ │ ├── PennTreebankHeadFinder.cs
│ │ │ ├── PennTreebankMentionFinder.cs
│ │ │ ├── ShallowParseMentionFinder.cs
│ │ │ └── WordnetDictionary.cs
│ │ ├── Resolver
│ │ │ ├── AbstractResolver.cs
│ │ │ ├── CommonNounResolver.cs
│ │ │ ├── DefaultNonReferentialResolver.cs
│ │ │ ├── DefiniteNounResolver.cs
│ │ │ ├── FixedNonReferentialResolver.cs
│ │ │ ├── INonReferentialResolver.cs
│ │ │ ├── IResolver.cs
│ │ │ ├── IsAResolver.cs
│ │ │ ├── MaximumEntropyResolver.cs
│ │ │ ├── PerfectResolver.cs
│ │ │ ├── PluralNounResolver.cs
│ │ │ ├── PluralPronounResolver.cs
│ │ │ ├── ProperNounResolver.cs
│ │ │ ├── ResolverMode.cs
│ │ │ ├── SingletonNonReferentialResolver.cs
│ │ │ ├── SingularPronounResolver.cs
│ │ │ └── SpeechPronounResolver.cs
│ │ ├── Similarity
│ │ │ ├── Context.cs
│ │ │ ├── Gender.cs
│ │ │ ├── GenderEnum.cs
│ │ │ ├── GenderModel.cs
│ │ │ ├── ITestGenderModel.cs
│ │ │ ├── ITestNumberModel.cs
│ │ │ ├── ITestSimilarityModel.cs
│ │ │ ├── ITrainSimilarityModel.cs
│ │ │ ├── MaximumEntropyCompatibilityModel.cs
│ │ │ ├── Number.cs
│ │ │ ├── NumberEnum.cs
│ │ │ ├── NumberModel.cs
│ │ │ ├── SemanticCompatibility.cs
│ │ │ ├── SemanticEnum.cs
│ │ │ └── SimilarityModel.cs
│ │ └── TreebankLinker.cs
│ ├── NameFind
│ │ ├── DefaultNameContextGenerator.cs
│ │ ├── EnglishNameFinder.cs
│ │ ├── INameContextGenerator.cs
│ │ ├── INameFinder.cs
│ │ ├── MaximumEntropyNameFinder.cs
│ │ └── NameFinderEventReader.cs
│ ├── Parser
│ │ ├── BuildContextGenerator.cs
│ │ ├── CheckContextGenerator.cs
│ │ ├── ChunkContextGenerator.cs
│ │ ├── EnglishHeadRules.cs
│ │ ├── EnglishTreebankParser.cs
│ │ ├── IHeadRules.cs
│ │ ├── IParserChunker.cs
│ │ ├── IParserTagger.cs
│ │ ├── MaximumEntropyParser.cs
│ │ ├── Parse.cs
│ │ └── ParserEventReader.cs
│ ├── PosTagger
│ │ ├── DefaultPosContextGenerator.cs
│ │ ├── EnglishMaximumEntropyPosTagger.cs
│ │ ├── IPosContextGenerator.cs
│ │ ├── IPosTagger.cs
│ │ ├── MaximumEntropyPosTagger.cs
│ │ ├── PosEventReader.cs
│ │ ├── PosLookupList.cs
│ │ └── PosLookupListWriter.cs
│ ├── SentenceDetect
│ │ ├── DefaultEndOfSentenceScanner.cs
│ │ ├── EnglishMaximumEntropySentenceDetector.cs
│ │ ├── IEndOfSentenceScanner.cs
│ │ ├── ISentenceDectector.cs
│ │ ├── MaximumEntropySentenceDetector.cs
│ │ ├── SentenceDetectionContextGenerator.cs
│ │ ├── SentenceDetectionEvent.cs
│ │ └── SentenceDetectionEventReader.cs
│ ├── Tokenize
│ │ ├── EnglishMaximumEntropyTokenizer.cs
│ │ ├── ITokenizer.cs
│ │ ├── MaximumEntropyTokenizer.cs
│ │ ├── TokenContextGenerator.cs
│ │ ├── TokenEventReader.cs
│ │ └── TokenSpanEventReader.cs
│ └── Util
│ │ ├── BeamSearch.cs
│ │ ├── Cache.cs
│ │ ├── CollectionEventStream.cs
│ │ ├── CountedSet.cs
│ │ ├── HashList.cs
│ │ ├── HashSet.cs
│ │ ├── IBeamSearchContextGenerator.cs
│ │ ├── IHeap.cs
│ │ ├── ListHeap.cs
│ │ ├── Pair.cs
│ │ ├── ReverseListIterator.cs
│ │ ├── Sequence.cs
│ │ ├── Set.cs
│ │ ├── SortedSet.cs
│ │ ├── Span.cs
│ │ ├── StringTokenizer.cs
│ │ ├── TreeHeap.cs
│ │ └── TreeSet.cs
├── app.config
├── models
│ ├── Coref.zip
│ ├── Coref
│ │ ├── acronyms
│ │ ├── cmodel.nbin
│ │ ├── cmodel_nr.nbin
│ │ ├── defmodel.nbin
│ │ ├── defmodel_nr.nbin
│ │ ├── fmodel.nbin
│ │ ├── fmodel_nr.nbin
│ │ ├── gen.fem
│ │ ├── gen.mal
│ │ ├── gen.nbin
│ │ ├── imodel.nbin
│ │ ├── imodel_nr.nbin
│ │ ├── num.nbin
│ │ ├── plmodel.nbin
│ │ ├── plmodel_nr.nbin
│ │ ├── pmodel.nbin
│ │ ├── pmodel_nr.nbin
│ │ ├── pnmodel.nbin
│ │ ├── pnmodel_nr.nbin
│ │ ├── sim.nbin
│ │ ├── tmodel.nbin
│ │ └── tmodel_nr.nbin
│ ├── EnglishChunk.nbin
│ ├── EnglishPOS.nbin
│ ├── EnglishSD.nbin
│ ├── EnglishTok.nbin
│ ├── NameFind
│ │ ├── date.nbin
│ │ ├── location.nbin
│ │ ├── money.nbin
│ │ ├── organization.nbin
│ │ ├── percentage.nbin
│ │ ├── person.nbin
│ │ └── time.nbin
│ └── Parser
│ │ ├── build.nbin
│ │ ├── check.nbin
│ │ ├── chunk.nbin
│ │ ├── head_rules
│ │ ├── tag.nbin
│ │ └── tagdict
└── packages.config
├── ParseTree
├── App.config
├── App.ico
├── AssemblyInfo.cs
├── MainForm.cs
├── MainForm.resx
├── ParseTree.csproj
└── packages.config
├── SharpWordNet
├── AssemblyInfo.cs
├── DataFileEngine.cs
├── IndexWord.cs
├── Morph
│ ├── AbstractDelegatingOperation.cs
│ ├── DetachSuffixesOperation.cs
│ ├── IOperation.cs
│ ├── LookupExceptionsOperation.cs
│ ├── LookupIndexWordOperation.cs
│ ├── TokenizerOperation.cs
│ └── Util.cs
├── Relation.cs
├── RelationType.cs
├── SharpWordNet.csproj
├── SharpWordNet.sln
├── Synset.cs
├── TestHarness
│ ├── App.ico
│ ├── AssemblyInfo.cs
│ ├── TestHarness.csproj
│ ├── WordNetBrowser.cs
│ └── WordNetBrowser.resx
├── Tokenizer.cs
├── WordNetEngine.cs
├── app.config
└── packages.config
└── ToolsExample
├── App.config
├── App.ico
├── AssemblyInfo.cs
├── MainForm.cs
├── MainForm.resx
├── ToolsExample.csproj
└── packages.config
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/ConsoleApp1/ConsoleApp1.xproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 14.0
5 | $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)
6 |
7 |
8 |
9 | 75a1d9ee-db24-49e2-9683-98d93473244e
10 | ConsoleApp1
11 | ..\artifacts\obj\$(MSBuildProjectName)
12 | ..\artifacts\bin\$(MSBuildProjectName)\
13 |
14 |
15 | ConsoleApp1
16 |
17 |
18 | 2.0
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/ConsoleApp1/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Threading.Tasks;
5 | using OpenNLP;
6 | using OpenNLP.Tools;
7 |
8 | namespace ConsoleApp1
9 | {
10 | public class Program
11 | {
12 |
13 | private string mModelPath= @"C:\Projects\DotNet\OpenNLP\OpenNLP\Models";
14 |
15 | private OpenNLP.Tools.SentenceDetect.MaximumEntropySentenceDetector mSentenceDetector;
16 |
17 | public void Main(string[] args)
18 | {
19 | if (mSentenceDetector == null)
20 | {
21 | mSentenceDetector = new OpenNLP.Tools.SentenceDetect.EnglishMaximumEntropySentenceDetector(mModelPath + "EnglishSD.nbin");
22 | }
23 |
24 | var test = mSentenceDetector.SentenceDetect("Hi! I'm three sentences. Are you?");
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/ConsoleApp1/project.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0-*",
3 | "description": "",
4 | "authors": [ "" ],
5 | "tags": [ "" ],
6 | "projectUrl": "",
7 | "licenseUrl": "",
8 |
9 | "dependencies": {
10 | },
11 |
12 | "commands": {
13 | "ConsoleApp1": "ConsoleApp1"
14 | },
15 |
16 | "frameworks": {
17 | "dnx451": {
18 | "dependencies": {
19 | "OpenNLP": "1.0.0-*"
20 | }
21 | },
22 | "dnxcore50": {
23 | "dependencies": {
24 | "System.Console": "4.0.0-beta-22816",
25 | "System.Collections": "4.0.10-beta-22816",
26 | "System.Linq": "4.0.0-beta-22816",
27 | "System.Threading": "4.0.10-beta-22816",
28 | "Microsoft.CSharp": "4.0.0-beta-22816"
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/ConsoleApplication1/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ConsoleApplication1/ConsoleApplication1.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {66951A02-A295-4185-9436-0DABF7D2BF20}
8 | Exe
9 | Properties
10 | ConsoleApplication1
11 | ConsoleApplication1
12 | v4.5.2
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | {b70185df-81fd-4417-914f-7c90e65e7d9f}
55 | OpenNLP
56 |
57 |
58 |
59 |
66 |
--------------------------------------------------------------------------------
/ConsoleApplication1/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ConsoleApplication1
8 | {
9 | class Program
10 | {
11 |
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/ConsoleApplication1/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ConsoleApplication1")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ConsoleApplication1")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("66951a02-a295-4185-9436-0dabf7d2bf20")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ConsoleApplication2/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ConsoleApplication2/ConsoleApplication2.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {D6480D45-37AC-411D-B33A-9730CD0B70A0}
8 | Exe
9 | Properties
10 | ConsoleApplication2
11 | ConsoleApplication2
12 | v4.5.2
13 | 512
14 | true
15 |
16 |
17 | AnyCPU
18 | true
19 | full
20 | false
21 | bin\Debug\
22 | DEBUG;TRACE
23 | prompt
24 | 4
25 |
26 |
27 | AnyCPU
28 | pdbonly
29 | true
30 | bin\Release\
31 | TRACE
32 | prompt
33 | 4
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | {b70185df-81fd-4417-914f-7c90e65e7d9f}
55 | OpenNLP
56 |
57 |
58 |
59 |
66 |
--------------------------------------------------------------------------------
/ConsoleApplication2/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ConsoleApplication2
8 | {
9 | class Program
10 | {
11 | private static string mModelPath = @"C:\Projects\DotNet\OpenNLP\OpenNLP\Models\";
12 | private static OpenNLP.Tools.SentenceDetect.MaximumEntropySentenceDetector mSentenceDetector;
13 |
14 | static void Main(string[] args)
15 | {
16 | if (mSentenceDetector == null)
17 | {
18 | mSentenceDetector = new OpenNLP.Tools.SentenceDetect.EnglishMaximumEntropySentenceDetector(mModelPath + "EnglishSD.nbin");
19 | }
20 |
21 | var test = mSentenceDetector.SentenceDetect("Not a chance. Hi! Mr. Arnold L. Watson is a big guy. I'm three sentences. Are you?");
22 | }
23 | }
24 | }
25 |
26 |
27 |
--------------------------------------------------------------------------------
/ConsoleApplication2/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ConsoleApplication2")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ConsoleApplication2")]
13 | [assembly: AssemblyCopyright("Copyright © 2015")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("d6480d45-37ac-411d-b33a-9730cd0b70a0")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/Lithium/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) Francois Vanderseypen "The Netron Project".
3 |
4 | All rights reserved.
5 |
6 | NO WARRANTY
7 |
8 | BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
9 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
10 |
11 | Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
12 |
13 | 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
14 |
15 | 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
16 |
17 | 3. This notice may not be removed or altered from any source distribution.
18 |
19 | */
20 | using System;
21 | using System.Reflection;
22 | using System.Runtime.CompilerServices;
23 | [assembly: AssemblyTitle("Lithium")]
24 | [assembly: AssemblyDescription("A tree layout control")]
25 |
26 | [assembly: AssemblyCompany("The Netron Project")]
27 | [assembly: AssemblyProduct("The Netron Project")]
28 | [assembly: AssemblyCopyright("Copyright (c) Francois Vanderseypen 'The Netron Project'")]
29 | [assembly: AssemblyVersion("3.3.*")]
30 |
31 | [assembly: CLSCompliant(false)]
32 | #if DEBUG
33 | [assembly: AssemblyConfiguration("Debug")]
34 | #else
35 | [assembly: AssemblyConfiguration("Release")]
36 | #endif
37 |
38 |
39 |
--------------------------------------------------------------------------------
/Lithium/Collections/ConnectionCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | namespace Netron.Lithium
4 | {
5 | ///
6 | /// STC of connections
7 | ///
8 | ///
9 | public class ConnectionCollection: CollectionBase
10 | {
11 |
12 |
13 | ///
14 | /// Adds a connection to the collection
15 | ///
16 | /// a connection
17 | /// the index of the added element in the collection
18 | public int Add(Connection con)
19 | {
20 | return this.InnerList.Add(con);
21 | }
22 |
23 | ///
24 | /// integer indexer; gets the connection stored in the collection in the given position
25 | ///
26 | public Connection this[int index]
27 | {
28 | get{return this.InnerList[index] as Connection;}
29 | }
30 | ///
31 | /// Removes a connection from the collection
32 | ///
33 | /// a connection object
34 | public void Remove(Connection con)
35 | {
36 | this.InnerList.Remove(con);
37 | }
38 | ///
39 | /// Removes a connection from the collection
40 | ///
41 | /// the 'from' or 'to' (ShapeBase) part of the connection
42 | /// the complementary 'from' or 'to' (ShapeBase) part of the connection
43 | public void Remove(ShapeBase one, ShapeBase two)
44 | {
45 | for(int k=0; k
6 | /// STC of shapes
7 | ///
8 | public class ShapeCollection: CollectionBase
9 | {
10 | ///
11 | /// Occurse when a shape is added to the collection
12 | ///
13 | public event ShapeData OnShapeAdded;
14 | ///
15 | /// Adds a shape to the collection
16 | ///
17 | /// a ShapeBase object
18 | /// the index of the added object in the collection
19 | public int Add(ShapeBase shape)
20 | {
21 | int newid = this.InnerList.Add(shape);
22 | if(OnShapeAdded!=null)
23 | OnShapeAdded(shape);
24 | return newid;
25 | }
26 |
27 | ///
28 | /// integer indexer
29 | ///
30 | public ShapeBase this[int index]
31 | {
32 | get{return this.InnerList[index] as ShapeBase;}
33 | }
34 | ///
35 | /// string indexer
36 | /// Gets the connection (if any) from the collection with the given UID
37 | ///
38 | public ShapeBase this[string uid]
39 | {
40 | get{
41 | for(int k=0;k
48 | /// Removes the connection from the collection
49 | ///
50 | /// a ShapeBase object
51 | public void Remove(ShapeBase shape)
52 | {
53 | this.InnerList.Remove(shape);
54 | }
55 |
56 |
57 | }
58 |
59 |
60 | }
61 |
62 |
--------------------------------------------------------------------------------
/Lithium/Delegates/Delegates.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Netron.Lithium
4 | {
5 | ///
6 | /// the info coming with the show-props event
7 | ///
8 | public delegate void ShowProps(object ent);
9 | ///
10 | /// to pass shape data to the outside world
11 | ///
12 | public delegate void ShapeData(ShapeBase shape);
13 |
14 | ///
15 | /// General purpose delegate to pass info to the outside world
16 | ///
17 | public delegate void Messager(string message);
18 | }
19 |
--------------------------------------------------------------------------------
/Lithium/Enums/Enums.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Netron.Lithium
4 | {
5 | ///
6 | /// The shape types available in this assembly
7 | ///
8 | public enum ShapeTypes
9 | {
10 | ///
11 | /// the default rectangular shape
12 | ///
13 | Rectangular,
14 | ///
15 | /// an oval shape
16 | ///
17 | Oval,
18 | ///
19 | /// a text label
20 | ///
21 | TextLabel
22 | }
23 |
24 | ///
25 | /// The direction in which the tree layout spreads the diagram
26 | ///
27 | public enum TreeDirection
28 | {
29 | ///
30 | /// the layout orders the shapes along the vertical line
31 | ///
32 | Vertical,
33 | ///
34 | /// the layout orders the shapes along an horizontal line
35 | ///
36 | Horizontal
37 | }
38 |
39 | ///
40 | /// The types of connections in this assembly
41 | ///
42 | public enum ConnectionType
43 | {
44 | ///
45 | /// The default connection simply connects the centers of the shapes
46 | ///
47 | Default,
48 | ///
49 | /// the traditional connection is a rectangular connections which mimics the traditional
50 | /// layout of hierarchies and flowcharts
51 | ///
52 | Traditional,
53 | ///
54 | /// a smoothly curved form connecting the shapes
55 | ///
56 | Bezier
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/Lithium/IO/DataType.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Xml;
4 | using System.Xml.Serialization;
5 | using System.IO;
6 |
7 | namespace Netron.Lithium
8 | {
9 |
10 | ///
11 | /// Whatever data type the property of an entity is, this can hold it
12 | ///
13 | [XmlType(IncludeInSchema=true, TypeName="data.type")]
14 | [XmlRoot(ElementName="Data", IsNullable=false, DataType="")]
15 | public class DataType
16 | {
17 |
18 | #region Fields
19 | ///
20 | /// a text collection
21 | ///
22 | private GraphDataCollection text = new GraphDataCollection();
23 |
24 | ///
25 | /// the key of the property
26 | ///
27 | private string key;
28 |
29 | ///
30 | /// the id of the property
31 | ///
32 | private string id;
33 | #endregion
34 |
35 | #region Properties
36 | ///
37 | /// Gets or sets the key
38 | ///
39 | [XmlAttribute(AttributeName="key")]
40 | public virtual string Key
41 | {
42 | get
43 | {
44 | return this.key;
45 | }
46 | set
47 | {
48 | this.key = value;
49 | }
50 | }
51 |
52 |
53 |
54 | ///
55 | /// Gets or sets the id
56 | ///
57 | [XmlAttribute(AttributeName="id")]
58 | public virtual string ID
59 | {
60 | get
61 | {
62 | return this.id;
63 | }
64 | set
65 | {
66 | this.id = value;
67 | }
68 | }
69 |
70 |
71 | ///
72 | /// Get or sets the text of the property
73 | ///
74 | [XmlText(Type=typeof(string))]
75 | public virtual GraphDataCollection Text
76 | {
77 | get
78 | {
79 | return this.text;
80 | }
81 | set
82 | {
83 | this.text = value;
84 | }
85 | }
86 | #endregion
87 |
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/Lithium/IO/EdgeType.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Xml;
4 | using System.Xml.Serialization;
5 | using System.IO;
6 |
7 |
8 | namespace Netron.Lithium
9 | {
10 | ///
11 | /// Stores the edge properties in the form of an XML element
12 | ///
13 | [XmlType(IncludeInSchema=true, TypeName="edge.type")]
14 | [XmlRoot(ElementName="Edge", IsNullable=false, DataType="")]
15 | public class EdgeType
16 | {
17 | #region Fields
18 | ///
19 | /// the set of subnodes under the XML element
20 | ///
21 | private GraphDataCollection data = new GraphDataCollection();
22 |
23 | ///
24 | /// the uid of the shape where the edge originates
25 | ///
26 | private string from;
27 | ///
28 | /// the uid of the shape where the edge ends
29 | ///
30 | private string to;
31 |
32 | #endregion
33 |
34 | #region Properties
35 |
36 | ///
37 | /// Generic data collection of properties
38 | ///
39 | [XmlElement(ElementName="Data", Type=typeof(DataType))]
40 | public virtual GraphDataCollection Data
41 | {
42 | get
43 | {
44 | return this.data;
45 | }
46 | set
47 | {
48 | this.data = value;
49 | }
50 | }
51 |
52 |
53 | ///
54 | /// The UID of the shape where the connection starts
55 | ///
56 | [XmlAttribute(AttributeName="From")]
57 | public virtual string From
58 | {
59 | get
60 | {
61 | return this.from;
62 | }
63 | set
64 | {
65 | this.from = value;
66 | }
67 | }
68 |
69 |
70 | ///
71 | /// The UID of the shape where the connection ends
72 | ///
73 | [XmlAttribute(AttributeName="To")]
74 | public virtual string To
75 | {
76 | get
77 | {
78 | return this.to;
79 | }
80 | set
81 | {
82 | this.to = value;
83 | }
84 | }
85 | #endregion
86 |
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/Lithium/IO/GraphDataAttribute.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Collections;
4 | using System.Reflection;
5 |
6 | namespace Netron.Lithium
7 | {
8 | ///
9 | /// Attribute class for designating which properties will be serialized
10 | /// by the GraphML serializer.
11 | ///
12 | ///
13 | [AttributeUsage(AttributeTargets.Property,AllowMultiple = false)]
14 | public class GraphDataAttribute : System.Attribute
15 | {
16 | #region Delegates
17 | private delegate void ToStringDelegate();
18 | private delegate void FromStringDelegate();
19 | #endregion
20 |
21 | ///
22 | /// Returns the tagged properties of the gibven object
23 | ///
24 | /// whatever class
25 | /// a hashtable of property names with their values
26 | public static Hashtable GetValuesOfTaggedFields(object value)
27 | {
28 | Hashtable vs = new Hashtable();
29 |
30 | foreach (PropertyInfo pi in value.GetType().GetProperties())
31 | {
32 | if (Attribute.IsDefined(pi, typeof(GraphDataAttribute)))
33 | {
34 | vs.Add(pi.Name,pi.GetValue(value,null));
35 | }
36 | }
37 |
38 | return vs;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Lithium/IO/GraphDataCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Netron.Lithium
4 | {
5 | ///
6 | /// Generic Collectioon of GraphML related data
7 | ///
8 | public class GraphDataCollection : System.Collections.CollectionBase
9 | {
10 |
11 | #region Properties
12 | ///
13 | /// integer indexer
14 | ///
15 | public virtual object this[int index]
16 | {
17 | get
18 | {
19 | return this.List[index];
20 | }
21 | set
22 | {
23 | this.List[index] = value;
24 | }
25 | }
26 |
27 | #endregion
28 |
29 | #region Methods
30 | ///
31 | /// Adds and object to the collection
32 | ///
33 | ///
34 | public virtual void Add(object o)
35 | {
36 | this.List.Add(o);
37 | }
38 |
39 |
40 | ///
41 | /// Returns whether the given object is stored in the collection
42 | ///
43 | /// whatever object
44 | /// true if contained otherwise false
45 | public virtual bool Contains(object o)
46 | {
47 | return this.List.Contains(o);
48 | }
49 |
50 |
51 | ///
52 | /// Removes an element from the collection
53 | ///
54 | ///
55 | public virtual void Remove(object o)
56 | {
57 | this.List.Remove(o);
58 | }
59 |
60 |
61 | ///
62 | /// Overrides the default implementation to collect the data of the collection
63 | ///
64 | ///
65 | public override string ToString()
66 | {
67 | System.IO.StringWriter sw = new System.IO.StringWriter();
68 | //
69 | // This loop mimics a foreach call. See C# programming language, pg 247
70 | // Here, the enumerator is seale and does not implement IDisposable
71 | System.Collections.IEnumerator enumerator = this.List.GetEnumerator();
72 | for (
73 | ; enumerator.MoveNext();
74 | )
75 | {
76 | string s = ((string)(enumerator.Current));
77 | // foreach body
78 | sw.Write(s);
79 | }
80 | //
81 | return sw.ToString();
82 | }
83 |
84 | #endregion
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/Lithium/IO/GraphType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Xml;
3 | using System.Xml.Serialization;
4 | using System.IO;
5 | namespace Netron.Lithium
6 | {
7 | ///
8 | /// This is the root of the XML serialization class.
9 | /// It acts as a kind of proxy class between the XML and the actual GraphAbstract.
10 | ///
11 | [XmlType(IncludeInSchema=true, TypeName="graph.type")]
12 | [XmlRoot(ElementName="NetronLightGraph", IsNullable=false, DataType="")]
13 | public class GraphType
14 | {
15 | #region Fields
16 | private GraphDataCollection nodes = new GraphDataCollection();
17 | private GraphDataCollection edges = new GraphDataCollection();
18 |
19 | private string description;
20 | private string id;
21 | #endregion
22 |
23 | #region Properties
24 | ///
25 | /// Gets or sets the description of the diagram
26 | ///
27 | [XmlElement(ElementName="Description")]
28 | public virtual string Description
29 | {
30 | get
31 | {
32 | return this.description;
33 | }
34 | set
35 | {
36 | this.description = value;
37 | }
38 | }
39 |
40 |
41 |
42 |
43 | ///
44 | /// Gets or sets the node collection
45 | ///
46 | [XmlElement(ElementName="Node", Type=typeof(NodeType))]
47 | public virtual GraphDataCollection Nodes
48 | {
49 | get
50 | {
51 | return this.nodes;
52 | }
53 | set
54 | {
55 | this.nodes = value;
56 | }
57 | }
58 |
59 | ///
60 | /// Gets or sets the edge collection
61 | ///
62 | [XmlElement(ElementName="Edge", Type=typeof(EdgeType))]
63 | public virtual GraphDataCollection Edges
64 | {
65 | get
66 | {
67 | return this.edges;
68 | }
69 | set
70 | {
71 | this.edges = value;
72 | }
73 | }
74 |
75 |
76 |
77 | ///
78 | /// Gets or sets the id
79 | ///
80 | [XmlAttribute(AttributeName="id")]
81 | public virtual string ID
82 | {
83 | get
84 | {
85 | return this.id;
86 | }
87 | set
88 | {
89 | this.id = value;
90 | }
91 | }
92 |
93 |
94 |
95 |
96 |
97 | #endregion
98 | }
99 | }
100 |
101 |
102 |
--------------------------------------------------------------------------------
/Lithium/IO/NodeType.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Xml;
4 | using System.Xml.Serialization;
5 | using System.IO;
6 |
7 |
8 | namespace Netron.Lithium
9 | {
10 | ///
11 | /// The proxy class between the shape and the serialized XML
12 | ///
13 | [XmlType(IncludeInSchema=true, TypeName="node.type")]
14 | [XmlRoot(ElementName="Node", IsNullable=false, DataType="")]
15 | public class NodeType
16 | {
17 | #region Fields
18 | private GraphDataCollection data = new GraphDataCollection();
19 | private string id;
20 | private string type;
21 | #endregion
22 |
23 | #region Properties
24 | ///
25 | /// Generic collection of properties
26 | ///
27 | [XmlElement(ElementName="Data", Type=typeof(DataType))]
28 | public virtual GraphDataCollection Items
29 | {
30 | get
31 | {
32 | return this.data;
33 | }
34 | set
35 | {
36 | this.data = value;
37 | }
38 | }
39 |
40 |
41 | ///
42 | /// The Uid of the shape
43 | ///
44 | [XmlAttribute(AttributeName="id")]
45 | public virtual string ID
46 | {
47 | get
48 | {
49 | return this.id;
50 | }
51 | set
52 | {
53 | this.id = value;
54 | }
55 | }
56 |
57 | ///
58 | /// The Uid of the shape
59 | ///
60 | [XmlAttribute(AttributeName="Type")]
61 | public virtual string Type
62 | {
63 | get
64 | {
65 | return this.type;
66 | }
67 | set
68 | {
69 | this.type = value;
70 | }
71 | }
72 |
73 |
74 | #endregion
75 |
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/Lithium/IO/ParentChild.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Netron.Lithium
4 | {
5 | ///
6 | /// Utility class to speed up the deserialization of connections
7 | ///
8 | public struct ParentChild
9 | {
10 | ///
11 | /// Default ctor
12 | ///
13 | ///
14 | ///
15 | public ParentChild( ShapeBase child, string parent)
16 | {
17 | this.Parent = parent;
18 | this.ChildShape = child;
19 | //this.ParentShape = null;
20 | //this.ChildShape = null;
21 | }
22 | ///
23 | /// Gets or sets the parent in this relation
24 | ///
25 | public string Parent;
26 | ///
27 | /// Gets or sets the child in this relation
28 | ///
29 | public ShapeBase ChildShape;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Lithium/IO/ParentChildCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 |
4 | namespace Netron.Lithium
5 | {
6 | ///
7 | /// STC of ParentChild collection
8 | ///
9 | public class ParentChildCollection : CollectionBase
10 | {
11 | ///
12 | /// integer indexer
13 | ///
14 | public ParentChild this[int index]
15 | {
16 | get{return (ParentChild) this.InnerList[index] ;}
17 | }
18 |
19 | ///
20 | /// Adds an item to the collection
21 | ///
22 | /// a ParentChild object
23 | ///
24 | public int Add(ParentChild pc)
25 | {
26 | return this.InnerList.Add(pc);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Lithium/Interfaces/Interfaces.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Netron.Lithium
4 | {///
5 | /// Interface of a visitor
6 | ///
7 | public interface IVisitor
8 | {
9 | ///
10 | /// The actual action to perform on visited objects
11 | ///
12 | ///
13 | void Visit(ShapeBase shape);
14 | ///
15 | /// Whether the visiting process is done
16 | ///
17 | bool IsDone { get; }
18 | }
19 | ///
20 | /// Interface of a prepost visitor which allows you to have
21 | /// an action before, during and after a visit
22 | ///
23 | public interface IPrePostVisitor : IVisitor
24 | {
25 | ///
26 | /// action before the visit
27 | ///
28 | ///
29 | void PreVisit(ShapeBase shape);
30 | ///
31 | /// the action after the visit
32 | ///
33 | ///
34 | void PostVisit(ShapeBase shape);
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Lithium/LithiumControl.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/Lithium/LithiumControl.bmp
--------------------------------------------------------------------------------
/Lithium/Proxy.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 | using System.Xml;
4 | using System.Windows.Forms;
5 | using System.Drawing;
6 | using System.ComponentModel;
7 | using System.IO;
8 | using System.Collections;
9 | namespace Netron.Lithium
10 | {
11 | ///
12 | /// Simple proxy class for the control to display only specific properties.
13 | /// Not as sophisticated as the property-bag of the full Netron-control
14 | /// but does the job in this simple context.
15 | ///
16 | public class Proxy
17 | {
18 | #region Fields
19 | private LithiumControl site;
20 | #endregion
21 |
22 | #region Constructor
23 | ///
24 | /// Default ctor
25 | ///
26 | ///
27 | public Proxy(LithiumControl site)
28 | {this.site = site;}
29 | #endregion
30 |
31 | #region Methods
32 | ///
33 | /// Gets or sets the reference to the control instance
34 | ///
35 | [Browsable(false)]
36 | public LithiumControl Site
37 | {
38 | get{return site;}
39 | set{site = value;}
40 | }
41 | ///
42 | /// Gets or sets the backcolor
43 | ///
44 | [Browsable(true), Description("The backcolor of the canvas"), Category("Layout")]
45 | public Color BackColor
46 | {
47 | get{return this.site.BackColor;}
48 | set{this.site.BackColor = value;}
49 | }
50 |
51 | ///
52 | /// Gets or set the branch height
53 | ///
54 | [Browsable(true), Description("The height between the tree branches")]
55 | public int BranchHeight
56 | {
57 | get{return site.BranchHeight;}
58 | set{site.BranchHeight = value;}
59 | }
60 | ///
61 | /// Gets or sets the spacing between the nodes
62 | ///
63 | [Browsable(true)]
64 | public int WordSpacing
65 | {
66 | get{return site.WordSpacing;}
67 | set
68 | {
69 | site.WordSpacing = value;
70 | }
71 | }
72 |
73 |
74 |
75 |
76 | ///
77 | /// Gets or sets the description of the diagram
78 | ///
79 | [Browsable(true), Description("The description of the diagram."), Category("Diagram")]
80 | public string Description
81 | {
82 | get{return this.site.graphAbstract.Description;}
83 | set{this.site.graphAbstract.Description = value;}
84 | }
85 |
86 | ///
87 | /// Gets or sets the global connection type
88 | ///
89 | [Browsable(true), Description("The type of connection."), Category("Diagram")]
90 | public ConnectionType ConnectionType
91 | {
92 | get{return site.ConnectionType;}
93 | set
94 | {
95 | site.ConnectionType = value;
96 | }
97 | }
98 | #endregion
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/Lithium/Shapes/OvalShape.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | namespace Netron.Lithium
4 | {
5 | ///
6 | /// A simple oval shape
7 | ///
8 | public class OvalShape : ShapeBase
9 | {
10 |
11 | #region Constructor
12 | ///
13 | /// Default ctor
14 | ///
15 | ///
16 | public OvalShape(LithiumControl s) : base(s)
17 | {
18 |
19 | }
20 | #endregion
21 |
22 | #region Methods
23 | ///
24 | /// Tests whether the mouse hits this shape
25 | ///
26 | ///
27 | ///
28 | public override bool Hit(System.Drawing.Point p)
29 | {
30 | Rectangle r= new Rectangle(p, new Size(5,5));
31 | return rectangle.Contains(r);
32 | }
33 |
34 |
35 |
36 | ///
37 | /// Paints the shape on the canvas
38 | ///
39 | ///
40 | public override void Paint(System.Drawing.Graphics g)
41 | {
42 | g.FillEllipse(shapeBrush,rectangle);
43 |
44 |
45 | if(hovered || isSelected)
46 | g.DrawEllipse(new Pen(Color.Red,2F),rectangle);
47 | else
48 | g.DrawEllipse(blackPen,rectangle);
49 |
50 | //well, a lot should be said here like
51 | //the fact that one should measure the text before drawing it,
52 | //resize the width and height if the text if bigger than the rectangle,
53 | //alignment can be set and changes the drawing as well...
54 | //here we keep it really simple:
55 | if(text !=string.Empty)
56 | g.DrawString(text,font,Brushes.Black, rectangle.X+10,rectangle.Y+10);
57 | }
58 |
59 | ///
60 | /// Invalidates the shape
61 | ///
62 | public override void Invalidate()
63 | {
64 | Rectangle r = rectangle;
65 | r.Offset(-5,-5);
66 | r.Inflate(20,20);
67 | site.Invalidate(r);
68 | }
69 |
70 |
71 | #endregion
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/Lithium/Shapes/TextLabel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Drawing;
3 | namespace Netron.Lithium
4 | {
5 | ///
6 | /// A simple text label
7 | ///
8 | public class TextLabel : ShapeBase
9 | {
10 | #region Fields
11 |
12 | #endregion
13 |
14 | #region Constructor
15 | ///
16 | /// Default ctor
17 | ///
18 | ///
19 | public TextLabel(LithiumControl s) : base(s)
20 | {
21 | this.shapeColor = Color.Transparent;
22 | }
23 | #endregion
24 |
25 | #region Methods
26 | ///
27 | /// Tests whether the mouse hits this shape
28 | ///
29 | ///
30 | ///
31 | public override bool Hit(System.Drawing.Point p)
32 | {
33 | Rectangle r= new Rectangle(p, new Size(5,5));
34 | return rectangle.Contains(r);
35 | }
36 |
37 |
38 |
39 | ///
40 | /// Paints the shape on the canvas
41 | ///
42 | ///
43 | public override void Paint(System.Drawing.Graphics g)
44 | {
45 | g.FillRectangle(shapeBrush,rectangle);
46 | if(hovered || isSelected)
47 | g.DrawRectangle(new Pen(Color.Red,2F),rectangle);
48 |
49 |
50 | //well, a lot should be said here like
51 | //the fact that one should measure the text before drawing it,
52 | //resize the width and height if the text if bigger than the rectangle,
53 | //alignment can be set and changes the drawing as well...
54 | //here we keep it really simple:
55 | if(text !=string.Empty)
56 | g.DrawString(text,font,Brushes.Black, rectangle.X+10,rectangle.Y+10);
57 | }
58 |
59 | ///
60 | /// Invalidates the shape
61 | ///
62 | public override void Invalidate()
63 | {
64 | Rectangle r = rectangle;
65 | r.Offset(-5,-5);
66 | r.Inflate(20,20);
67 | site.Invalidate(r);
68 | }
69 |
70 | ///
71 | /// Overrides the resize to repaint the shape
72 | ///
73 | ///
74 | ///
75 | public override void Resize(int width, int height)
76 | {
77 | base.Resize (width, height);
78 | Invalidate();
79 | }
80 |
81 | #endregion
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/Lithium/Visitors/DeleteVisitor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Netron.Lithium
4 | {
5 | ///
6 | /// Deletion of shapes is implemented via a visitor pattern to handle the fact
7 | /// that child nodes have to be deleted before its parent
8 | ///
9 | public class DeleteVisitor: IVisitor
10 | {
11 |
12 | #region Fields
13 | ///
14 | /// Occurs when a shape is deleted
15 | ///
16 | public event ShapeData OnDelete;
17 |
18 | ///
19 | /// the reference to the abstract
20 | ///
21 | GraphAbstract graphAbstract;
22 |
23 | #endregion
24 |
25 | #region Constructor
26 | ///
27 | /// Constructor
28 | ///
29 | /// a GraphAbstract instance
30 | public DeleteVisitor(GraphAbstract graphAbstract)
31 | {
32 | this.graphAbstract = graphAbstract;
33 | }
34 |
35 | #endregion
36 |
37 | ///
38 | /// Visits the shape
39 | ///
40 | ///
41 | public void Visit(ShapeBase sh)
42 | {
43 | //remove from the shape from the Shapes
44 | if(sh==null) return;
45 | //strictly speaking we should remove the shape from its parent's childNodes collection first
46 | graphAbstract.Connections.Remove(sh.connection);
47 | graphAbstract.Shapes.Remove(sh);
48 | if(OnDelete!=null)
49 | OnDelete(sh);
50 | }
51 |
52 | ///
53 | /// Gets whether the visiting is done
54 | ///
55 | public bool IsDone
56 | {
57 | get
58 | {
59 | // TODO: Add DeleteVisitor.IsDone getter implementation
60 | return false;
61 | }
62 | }
63 |
64 |
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/Lithium/Visitors/ExpanderVisitor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Netron.Lithium
4 | {
5 | ///
6 | /// Expands each node on visit
7 | ///
8 | public class ExpanderVisitor : IVisitor
9 | {
10 | ///
11 | /// Visits the shape
12 | ///
13 | ///
14 | public void Visit(ShapeBase sh)
15 | {
16 | sh.Expand();
17 | }
18 |
19 | ///
20 | /// Gets whether the visiting is done
21 | ///
22 | public bool IsDone
23 | {
24 | get
25 | {
26 | return false;
27 | }
28 | }
29 |
30 |
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Lithium/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Lithium/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ModelConverter/App.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/ModelConverter/App.ico
--------------------------------------------------------------------------------
/ModelConverter/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | //
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | //
9 | [assembly: AssemblyTitle("")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("")]
14 | [assembly: AssemblyCopyright("")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | //
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Revision and Build Numbers
27 | // by using the '*' as shown below:
28 |
29 | [assembly: AssemblyVersion("1.0.*")]
30 |
31 | //
32 | // In order to sign your assembly you must specify a key to use. Refer to the
33 | // Microsoft .NET Framework documentation for more information on assembly signing.
34 | //
35 | // Use the attributes below to control which key is used for signing.
36 | //
37 | // Notes:
38 | // (*) If no key is specified, the assembly is not signed.
39 | // (*) KeyName refers to a key that has been installed in the Crypto Service
40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains
41 | // a key.
42 | // (*) If the KeyFile and the KeyName values are both specified, the
43 | // following processing occurs:
44 | // (1) If the KeyName can be found in the CSP, that key is used.
45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key
46 | // in the KeyFile is installed into the CSP and used.
47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
48 | // When specifying the KeyFile, the location of the KeyFile should be
49 | // relative to the project output directory which is
50 | // %Project Directory%\obj\. For example, if your KeyFile is
51 | // located in the project directory, you would specify the AssemblyKeyFile
52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
54 | // documentation for more information on this.
55 | //
56 | [assembly: AssemblyDelaySign(false)]
57 | [assembly: AssemblyKeyFile("")]
58 | [assembly: AssemblyKeyName("")]
59 |
--------------------------------------------------------------------------------
/ModelConverter/Converter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 | using SharpEntropy;
4 | using SharpEntropy.IO;
5 |
6 | namespace ModelConverter
7 | {
8 | ///
9 | /// Summary description for Converter.
10 | ///
11 | class Converter
12 | {
13 | ///
14 | /// The main entry point for the application.
15 | ///
16 | [STAThread]
17 | static void Main(string[] args)
18 | {
19 | if (args.Length != 1)
20 | {
21 | Console.WriteLine("You need to specify 1 argument - the path of the folder to convert.");
22 | }
23 | else
24 | {
25 | string modelPath = args[0];
26 |
27 | if (ConvertFolder(modelPath))
28 | {
29 | Console.WriteLine("conversion complete");
30 | }
31 | else
32 | {
33 | Console.WriteLine("conversion failed");
34 | }
35 | }
36 | Console.ReadLine();
37 | }
38 |
39 | private static bool ConvertFolder(string folder)
40 | {
41 | try
42 | {
43 | BinaryGisModelWriter writer = new BinaryGisModelWriter();
44 |
45 | foreach (string file in Directory.GetFiles(folder))
46 | {
47 | if (file.Substring(file.Length - 4, 4) == ".bin")
48 | {
49 | Console.Write("converting " + file + " ...");
50 | writer.Persist(new GisModel(new JavaBinaryGisModelReader(file)), file.Replace(".bin", ".nbin"));
51 | Console.WriteLine("done");
52 | }
53 | }
54 | }
55 | catch (Exception ex)
56 | {
57 | Console.WriteLine("Exception occurred: " + ex.Message);
58 | return false;
59 | }
60 |
61 | foreach (string childFolder in Directory.GetDirectories(folder))
62 | {
63 | if (!ConvertFolder(childFolder))
64 | {
65 | return false;
66 | }
67 | }
68 |
69 | return true;
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/ModelConverter/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/ModelConverter/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/OpenNLP/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | //
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | //
9 | [assembly: AssemblyTitle("")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("")]
14 | [assembly: AssemblyCopyright("")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | //
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Revision and Build Numbers
27 | // by using the '*' as shown below:
28 |
29 | [assembly: AssemblyVersion("1.0.*")]
30 |
31 | //
32 | // In order to sign your assembly you must specify a key to use. Refer to the
33 | // Microsoft .NET Framework documentation for more information on assembly signing.
34 | //
35 | // Use the attributes below to control which key is used for signing.
36 | //
37 | // Notes:
38 | // (*) If no key is specified, the assembly is not signed.
39 | // (*) KeyName refers to a key that has been installed in the Crypto Service
40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains
41 | // a key.
42 | // (*) If the KeyFile and the KeyName values are both specified, the
43 | // following processing occurs:
44 | // (1) If the KeyName can be found in the CSP, that key is used.
45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key
46 | // in the KeyFile is installed into the CSP and used.
47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
48 | // When specifying the KeyFile, the location of the KeyFile should be
49 | // relative to the project output directory which is
50 | // %Project Directory%\obj\. For example, if your KeyFile is
51 | // located in the project directory, you would specify the AssemblyKeyFile
52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
54 | // documentation for more information on this.
55 | //
56 | [assembly: AssemblyDelaySign(false)]
57 | [assembly: AssemblyKeyFile("")]
58 | [assembly: AssemblyKeyName("")]
59 |
--------------------------------------------------------------------------------
/OpenNLP/Properties/Resources.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace OpenNLP.Properties {
12 | using System;
13 |
14 |
15 | ///
16 | /// A strongly-typed resource class, for looking up localized strings, etc.
17 | ///
18 | // This class was auto-generated by the StronglyTypedResourceBuilder
19 | // class via a tool like ResGen or Visual Studio.
20 | // To add or remove a member, edit your .ResX file then rerun ResGen
21 | // with the /str option, or rebuild your VS project.
22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
25 | internal class Resources {
26 |
27 | private static global::System.Resources.ResourceManager resourceMan;
28 |
29 | private static global::System.Globalization.CultureInfo resourceCulture;
30 |
31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
32 | internal Resources() {
33 | }
34 |
35 | ///
36 | /// Returns the cached ResourceManager instance used by this class.
37 | ///
38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
39 | internal static global::System.Resources.ResourceManager ResourceManager {
40 | get {
41 | if (object.ReferenceEquals(resourceMan, null)) {
42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OpenNLP.Properties.Resources", typeof(Resources).Assembly);
43 | resourceMan = temp;
44 | }
45 | return resourceMan;
46 | }
47 | }
48 |
49 | ///
50 | /// Overrides the current thread's CurrentUICulture property for all
51 | /// resource lookups using this strongly typed resource class.
52 | ///
53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
54 | internal static global::System.Globalization.CultureInfo Culture {
55 | get {
56 | return resourceCulture;
57 | }
58 | set {
59 | resourceCulture = value;
60 | }
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/OpenNLP/Resources/EnglishChunk.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/Resources/EnglishChunk.nbin
--------------------------------------------------------------------------------
/OpenNLP/Tools/Chunker/IChunker.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the Chunker.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | using System.Collections;
38 |
39 | namespace OpenNLP.Tools.Chunker
40 | {
41 | ///
42 | /// The interface for chunkers which provide chunk tags for a sequence of tokens.
43 | ///
44 | public interface IChunker
45 | {
46 | ///
47 | /// Generates chunk tags for the given sequence returning the result in a list.
48 | ///
49 | ///
50 | /// a list of the tokens or words of the sequence.
51 | ///
52 | ///
53 | /// a list of the pos tags of the sequence.
54 | ///
55 | ///
56 | /// a list of chunk tags for each token in the sequence.
57 | ///
58 | ArrayList Chunk(ArrayList tokens, ArrayList tags);
59 |
60 | ///
61 | /// Generates chunk tags for the given sequence returning the result in an array.
62 | ///
63 | ///
64 | /// an array of the tokens or words of the sequence.
65 | ///
66 | ///
67 | /// an array of the pos tags of the sequence.
68 | ///
69 | ///
70 | /// an array of chunk tags for each token in the sequence.
71 | ///
72 | string[] Chunk(object[] tokens, string[] tags);
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/Chunker/IChunkerContextGenerator.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the ChunkerContextGenerator.java source file found in the
18 | //original java implementation of OpenNLP.
19 |
20 | using System;
21 | using System.Collections;
22 |
23 | namespace OpenNLP.Tools.Chunker
24 | {
25 | ///
26 | /// Context generator interface for chunkers.
27 | ///
28 | public interface IChunkerContextGenerator : Util.IBeamSearchContextGenerator
29 | {
30 | ///
31 | /// Returns the contexts for chunking of the specified index.
32 | ///
33 | ///
34 | /// The index of the token in the specified toks array for which the context should be constructed.
35 | ///
36 | ///
37 | /// The tokens of the sentence. The toString
methods of these objects should return the token text.
38 | ///
39 | ///
40 | /// The POS tags for the the specified tokens.
41 | ///
42 | /// ///
43 | /// The previous decisions made in the tagging of this sequence. Only indices less than tokenIndex will be examined.
44 | ///
45 | ///
46 | /// An array of predictive contexts on which a model basis its decisions.
47 | ///
48 | string[] GetContext(int tokenIndex, object[] tokens, string[] tags, string[] previousDecisions);
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/LinkerMode.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the LinkerMode.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | namespace OpenNLP.Tools.Coreference
38 | {
39 |
40 | ///
41 | /// Enumeration of modes in which a linker can run.
42 | ///
43 | public enum LinkerMode
44 | {
45 | ///
46 | /// Testing mode, used to identify coreference relationships in un-annotated text.
47 | ///
48 | Test,
49 | ///
50 | /// Training mode, used to learn coreference relationships in annotated text.
51 | ///
52 | Train,
53 | ///
54 | /// Evaluation mode, used to evaluate identifed coreference relationships based on annotated text.
55 | ///
56 | Eval,
57 | ///
58 | /// Training mode, used to learn coreference relationships in annotated text.
59 | ///
60 | Sim
61 | }
62 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Mention/DictionaryFactory.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the DictionaryFactory.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | using System.Configuration;
38 |
39 | namespace OpenNLP.Tools.Coreference.Mention
40 | {
41 | ///
42 | /// Factory class used to get an instance of a dictionary object.
43 | ///
44 | public class DictionaryFactory
45 | {
46 | ///
47 | /// Returns the default implementation of the Dictionary interface.
48 | ///
49 | public static IDictionary GetDictionary(string searchDirectory)
50 | {
51 | if (mDictionary == null)
52 | {
53 | try
54 | {
55 | mDictionary = new WordnetDictionary(searchDirectory);
56 | }
57 | catch (System.IO.IOException e)
58 | {
59 | System.Console.Error.WriteLine(e);
60 | }
61 | }
62 | return mDictionary;
63 | }
64 |
65 | public static IDictionary GetDictionary()
66 | {
67 | return GetDictionary(ConfigurationManager.AppSettings["WordnetSearchDirectory"]);
68 | }
69 |
70 | private static IDictionary mDictionary;
71 |
72 | private DictionaryFactory()
73 | {
74 | }
75 | }
76 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Mention/IMentionFinder.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the MentionFinder.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | namespace OpenNLP.Tools.Coreference.Mention
38 | {
39 |
40 | ///
41 | /// Specifies the interface that objects that determine the space of mentions for coreference should implement.
42 | ///
43 | public interface IMentionFinder
44 | {
45 | ///
46 | /// Specifies whether pre-nominal named-entities should be collected as mentions.
47 | ///
48 | bool PrenominalNamedEntitiesCollection
49 | {
50 | get;
51 | set;
52 | }
53 |
54 | ///
55 | /// Specifies whether coordinated noun phrases should be collected as mentions.
56 | ///
57 | bool CoordinatedNounPhrasesCollection
58 | {
59 | get;
60 | set;
61 | }
62 |
63 | ///
64 | /// Returns an array of mentions.
65 | ///
66 | ///
67 | /// A top level parse from which mentions are gathered.
68 | ///
69 | ///
70 | /// An array of mentions.
71 | ///
72 | Mention[] GetMentions(IParse parse);
73 | }
74 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Resolver/FixedNonReferentialResolver.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the FixedNonReferentialResolver.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | using MentionContext = OpenNLP.Tools.Coreference.Mention.MentionContext;
38 | namespace OpenNLP.Tools.Coreference.Resolver
39 | {
40 |
41 | /// Implementation of non-referential classifier which uses a fixed-value threshold.
42 | public class FixedNonReferentialResolver : INonReferentialResolver
43 | {
44 |
45 | private double mNonReferentialProbability;
46 |
47 | public FixedNonReferentialResolver(double nonReferentialProbability)
48 | {
49 | mNonReferentialProbability = nonReferentialProbability;
50 | }
51 |
52 | public virtual double GetNonReferentialProbability(MentionContext mention)
53 | {
54 | return mNonReferentialProbability;
55 | }
56 |
57 | public virtual void AddEvent(MentionContext mention)
58 | {
59 | }
60 |
61 | public virtual void Train()
62 | {
63 | }
64 | }
65 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Resolver/INonReferentialResolver.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the NonReferentialResolver.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 |
38 | namespace OpenNLP.Tools.Coreference.Resolver
39 | {
40 | ///
41 | /// Provides the interface for a object to provide a resolver with a non-referential
42 | /// probability. Non-referential resolvers compute the probability that a particular mention refers
43 | /// to no antecedent. This probability can then compete with the probability that
44 | /// a mention refers with a specific antecedent.
45 | ///
46 | public interface INonReferentialResolver
47 | {
48 | ///
49 | /// Returns the probability that the specified mention doesn't refer to any previous mention.
50 | ///
51 | ///
52 | /// The mention under consideration.
53 | ///
54 | ///
55 | /// A probability that the specified mention doesn't refer to any previous mention.
56 | ///
57 | double GetNonReferentialProbability(Mention.MentionContext mention);
58 |
59 | ///
60 | /// Designates that the specified mention be used for training.
61 | ///
62 | ///
63 | /// The mention to be used. The mention id is used to determine
64 | /// whether this mention is referential or non-referential.
65 | ///
66 | void AddEvent(Mention.MentionContext mention);
67 |
68 | ///
69 | /// Trains a model based on the events given to this resolver via AddEvent.
70 | ///
71 | void Train();
72 | }
73 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Resolver/PerfectResolver.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the PerfectResolver.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | using DiscourseEntity = OpenNLP.Tools.Coreference.DiscourseEntity;
38 | using DiscourseModel = OpenNLP.Tools.Coreference.DiscourseModel;
39 | using MentionContext = OpenNLP.Tools.Coreference.Mention.MentionContext;
40 | namespace OpenNLP.Tools.Coreference.Resolver
41 | {
42 |
43 | /// Resolver used in training to update the discourse model based on the coreference annotation.
44 | public class PerfectResolver:AbstractResolver
45 | {
46 |
47 | public PerfectResolver():base(0)
48 | {
49 | }
50 |
51 | public override bool CanResolve(MentionContext ec)
52 | {
53 | return (true);
54 | }
55 |
56 | protected internal override bool IsOutOfRange(MentionContext ec, DiscourseEntity de)
57 | {
58 | return (false);
59 | }
60 |
61 | public override DiscourseEntity Resolve(MentionContext ec, DiscourseModel dm)
62 | {
63 | return (null);
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Resolver/ResolverMode.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the ResolverMode.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | namespace OpenNLP.Tools.Coreference.Resolver
38 | {
39 |
40 | /// Enumerated type specifying the modes if a resolver.
41 | public class ResolverMode
42 | {
43 |
44 | //UPGRADE_NOTE: Final was removed from the declaration of 'name '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
45 | private string name;
46 |
47 | private ResolverMode(string name)
48 | {
49 | this.name = name;
50 | }
51 |
52 | //UPGRADE_NOTE: Final was removed from the declaration of 'TEST '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
53 | public static readonly ResolverMode Test = new ResolverMode("test");
54 | //UPGRADE_NOTE: Final was removed from the declaration of 'TRAIN '. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1003'"
55 | public static readonly ResolverMode Train = new ResolverMode("train");
56 |
57 | public override string ToString()
58 | {
59 | return (name);
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Resolver/SingletonNonReferentialResolver.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the SingletonNonReferentialResolver.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | namespace OpenNLP.Tools.Coreference.Resolver
38 | {
39 |
40 | ///
41 | /// This class allows you to share a single instance of a non-referential resolver
42 | /// amoung several resolvers.
43 | ///
44 | public class SingletonNonReferentialResolver:DefaultNonReferentialResolver
45 | {
46 | private static SingletonNonReferentialResolver mResolver;
47 | private static bool mTrained;
48 |
49 | private SingletonNonReferentialResolver(string projectName, ResolverMode mode):base(projectName, "nonref", mode)
50 | {
51 | }
52 |
53 | public static SingletonNonReferentialResolver GetInstance(string modelName, ResolverMode mode)
54 | {
55 | if (mResolver == null)
56 | {
57 | mResolver = new SingletonNonReferentialResolver(modelName, mode);
58 | }
59 | return mResolver;
60 | }
61 |
62 | public override void Train()
63 | {
64 | if (!mTrained)
65 | {
66 | base.Train();
67 | mTrained = true;
68 | }
69 | }
70 |
71 | }
72 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Similarity/Gender.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the Gender.java source file found in the
18 | //original java implementation of OpenNLP.
19 |
20 | using System;
21 |
22 | namespace OpenNLP.Tools.Coreference.Similarity
23 | {
24 | public class Gender
25 | {
26 | private GenderEnum mType;
27 | private double mConfidence;
28 |
29 | public virtual GenderEnum Type
30 | {
31 | get
32 | {
33 | return mType;
34 | }
35 | }
36 |
37 | public virtual double Confidence
38 | {
39 | get
40 | {
41 | return mConfidence;
42 | }
43 | }
44 |
45 | public Gender(GenderEnum type, double confidence)
46 | {
47 | mType = type;
48 | mConfidence = confidence;
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Similarity/GenderEnum.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the GenderEnum.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 |
38 | namespace OpenNLP.Tools.Coreference.Similarity
39 | {
40 | ///
41 | /// Enumeration of gender types.
42 | ///
43 | public class GenderEnum
44 | {
45 | private string mGender;
46 |
47 | private GenderEnum(string gender)
48 | {
49 | mGender = gender;
50 | }
51 |
52 | public override string ToString()
53 | {
54 | return mGender;
55 | }
56 |
57 | ///
58 | /// Male gender.
59 | ///
60 | public static readonly GenderEnum Male = new GenderEnum("male");
61 |
62 | ///
63 | /// Female gender.
64 | ///
65 | public static readonly GenderEnum Female = new GenderEnum("female");
66 |
67 | ///
68 | /// Neuter gender.
69 | ///
70 | public static readonly GenderEnum Neuter = new GenderEnum("neuter");
71 |
72 | ///
73 | /// Unknown gender.
74 | ///
75 | public static readonly GenderEnum Unknown = new GenderEnum("unknown");
76 | }
77 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Similarity/ITestGenderModel.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the TestGenderModel.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | namespace OpenNLP.Tools.Coreference.Similarity
38 | {
39 |
40 | /// Interface for testing a gender model.
41 | public interface ITestGenderModel
42 | {
43 | int MaleIndex
44 | {
45 | get;
46 | }
47 |
48 | int FemaleIndex
49 | {
50 | get;
51 | }
52 |
53 | int NeuterIndex
54 | {
55 | get;
56 | }
57 |
58 | double[] GenderDistribution(Context nounPhrase);
59 | }
60 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Similarity/ITestNumberModel.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the TestNumberModel.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | namespace OpenNLP.Tools.Coreference.Similarity
38 | {
39 | ///
40 | /// Interface for testing a number model.
41 | ///
42 | public interface ITestNumberModel
43 | {
44 | int SingularIndex
45 | {
46 | get;
47 | }
48 |
49 | int PluralIndex
50 | {
51 | get;
52 | }
53 |
54 | double[] NumberDistribution(Context nounPhrase);
55 | }
56 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Similarity/ITestSimilarityModel.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the TestSimilarityModel.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 |
38 | namespace OpenNLP.Tools.Coreference.Similarity
39 | {
40 | ///
41 | /// Interface for testing a similarity model.
42 | ///
43 | public interface ITestSimilarityModel
44 | {
45 | double AreCompatible(Context firstNounPhrase, Context secondNounPhrase);
46 | }
47 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Similarity/ITrainSimilarityModel.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the TrainSimilarityModel.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 |
38 | namespace OpenNLP.Tools.Coreference.Similarity
39 | {
40 | ///
41 | /// Interface for training a similarity, gender, or number model.
42 | ///
43 | public interface ITrainSimilarityModel
44 | {
45 | ///
46 | /// Creates similarity training pairs based on the specified extents.
47 | /// Extents are considered compatible if they are in the same coreference chain,
48 | /// have the same named-entity tag, or share a common head word. Incompatible extents are chosen at random
49 | /// from the set of extents which don't meet this criteria.
50 | ///
51 | ///
52 | ///
53 | void SetExtents(Context[] extents);
54 |
55 | void TrainModel();
56 | }
57 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Similarity/Number.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the Number.java source file found in the
18 | //original java implementation of OpenNLP.
19 |
20 | using System;
21 |
22 | namespace OpenNLP.Tools.Coreference.Similarity
23 | {
24 | public class Number
25 | {
26 | private NumberEnum mType;
27 | private double mConfidence;
28 |
29 | public virtual NumberEnum Type
30 | {
31 | get
32 | {
33 | return mType;
34 | }
35 | }
36 |
37 | public virtual double Confidence
38 | {
39 | get
40 | {
41 | return mConfidence;
42 | }
43 | }
44 |
45 | public Number(NumberEnum type, double confidence)
46 | {
47 | mType = type;
48 | mConfidence = confidence;
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Similarity/NumberEnum.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the NumberEnum.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | namespace OpenNLP.Tools.Coreference.Similarity
38 | {
39 |
40 | /// Enumeration of number types.
41 | public class NumberEnum
42 | {
43 | private string mName;
44 |
45 | private NumberEnum(string name)
46 | {
47 | mName = name;
48 | }
49 |
50 | public override string ToString()
51 | {
52 | return mName;
53 | }
54 |
55 | ///
56 | /// Singular number type.
57 | ///
58 | public static readonly NumberEnum Singular = new NumberEnum("singular");
59 | ///
60 | /// Plural number type.
61 | ///
62 | public static readonly NumberEnum Plural = new NumberEnum("plural");
63 | ///
64 | /// Unknown number type.
65 | ///
66 | public static readonly NumberEnum Unknown = new NumberEnum("unknown");
67 | }
68 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Similarity/SemanticCompatibility.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the SemanticCompatibility.java source file found in the
18 | //original java implementation of OpenNLP.
19 |
20 | using System;
21 | namespace OpenNLP.Tools.Coreference.Similarity
22 | {
23 | public class SemanticCompatibility
24 | {
25 | private SemanticEnum mType;
26 | private double mConfidence;
27 |
28 | public virtual SemanticEnum Type
29 | {
30 | get
31 | {
32 | return mType;
33 | }
34 | }
35 |
36 | public virtual double Confidence
37 | {
38 | get
39 | {
40 | return mConfidence;
41 | }
42 | }
43 |
44 | public SemanticCompatibility(SemanticEnum type, double confidence)
45 | {
46 | mType = type;
47 | mConfidence = confidence;
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Coreference/Similarity/SemanticEnum.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the SemanticEnum.java source file found in the
18 | //original java implementation of OpenNLP.
19 |
20 | using System;
21 | namespace OpenNLP.Tools.Coreference.Similarity
22 | {
23 |
24 | public class SemanticEnum
25 | {
26 | private string mCompatibility;
27 |
28 | private SemanticEnum(string compatibility)
29 | {
30 | mCompatibility = compatibility;
31 | }
32 |
33 | public override string ToString()
34 | {
35 | return mCompatibility;
36 | }
37 |
38 | ///
39 | /// Semantically compatible.
40 | ///
41 | public static readonly SemanticEnum Compatible = new SemanticEnum("compatible");
42 |
43 | ///
44 | /// Semantically incompatible.
45 | ///
46 | public static readonly SemanticEnum Incompatible = new SemanticEnum("incompatible");
47 |
48 | ///
49 | /// Semantic compatibility Unknown.
50 | ///
51 | public static readonly SemanticEnum Unknown = new SemanticEnum("unknown");
52 |
53 |
54 | }
55 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/NameFind/INameContextGenerator.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the NameContextGenerator.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | using System.Collections.Generic;
38 |
39 | namespace OpenNLP.Tools.NameFind
40 | {
41 | ///
42 | /// Context generator for the name find tool.
43 | ///
44 | public interface INameContextGenerator : OpenNLP.Tools.Util.IBeamSearchContextGenerator
45 | {
46 | ///
47 | /// Returns the contexts for chunking of the specified index.
48 | ///
49 | ///
50 | /// The index of the token in the specified tokens array for which the context should be constructed.
51 | ///
52 | ///
53 | /// The tokens of the sentence.
54 | ///
55 | ///
56 | /// The previous decisions made in the tagging of this sequence. Only indices less than tokenIndex will be examined.
57 | ///
58 | ///
59 | /// A mapping between tokens and the previous outcome for these tokens.
60 | ///
61 | ///
62 | /// An array of predictive contexts on which a model basis its decisions.
63 | ///
64 | string[] GetContext(int tokenIndex, List tokens, List previousDecisions, IDictionary previousTags);
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/NameFind/INameFinder.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the NameFinder.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | using System.Collections;
38 |
39 | namespace OpenNLP.Tools.NameFind
40 | {
41 | ///
42 | /// The interface for name finders which provide name tags for a sequence of tokens.
43 | ///
44 | public interface INameFinder
45 | {
46 | ///
47 | /// Generates name tags for the given sequence returning the result in a list.
48 | ///
49 | ///
50 | /// a list of the tokens or words of the sequence.
51 | ///
52 | ///
53 | /// a mapping between tokens and outcomes from previous sentences.
54 | ///
55 | ///
56 | /// a list of chunk tags for each token in the sequence.
57 | ///
58 | ArrayList Find(ArrayList tokens, IDictionary previousTags);
59 |
60 | ///
61 | /// Generates name tags for the given sequence returning the result in an array.
62 | ///
63 | ///
64 | /// an array of the tokens or words of the sequence.
65 | ///
66 | ///
67 | /// a mapping between tokens and outcomes from previous sentences.
68 | ///
69 | ///
70 | /// an array of chunk tags for each token in the sequence.
71 | ///
72 | string[] Find(object[] tokens, IDictionary previousTags);
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/Parser/IHeadRules.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the HeadRules.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2004 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 |
38 | namespace OpenNLP.Tools.Parser
39 | {
40 | ///
41 | /// Interface for encoding the head rules associated with parsing.
42 | ///
43 | public interface IHeadRules
44 | {
45 | ///
46 | /// Returns the head constituent for the specified constituents of the specified type.
47 | ///
48 | ///
49 | /// The constituents which make up a constituent of the specified type.
50 | ///
51 | ///
52 | /// The type of a constituent which is made up of the specifed constituents.
53 | ///
54 | ///
55 | /// The constituent which is the head.
56 | ///
57 | Parse GetHead(Parse[] constituents, string type);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/Parser/IParserChunker.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the ParserChunker.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | using System.Collections;
38 |
39 | namespace OpenNLP.Tools.Parser
40 | {
41 | ///
42 | /// Interface that a chunker used with the parser should implement.
43 | ///
44 | public interface IParserChunker : Chunker.IChunker
45 | {
46 | ///
47 | /// Returns the top k chunk sequences for the specified sentence with the specified pos-tags
48 | ///
49 | ///
50 | /// The tokens of the sentence.
51 | ///
52 | ///
53 | /// The pos-tags for the specified sentence.
54 | ///
55 | ///
56 | /// the top k chunk sequences for the specified sentence.
57 | ///
58 | Util.Sequence[] TopKSequences(ArrayList sentence, ArrayList tags);
59 |
60 | ///
61 | /// Returns the top k chunk sequences for the specified sentence with the specified pos-tags
62 | ///
63 | ///
64 | /// The tokens of the sentence.
65 | ///
66 | ///
67 | /// The pos-tags for the specified sentence.
68 | ///
69 | ///
70 | ///
71 | ///
72 | /// the top k chunk sequences for the specified sentence.
73 | ///
74 | Util.Sequence[] TopKSequences(string[] sentence, string[] tags, double minSequenceScore);
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/Parser/IParserTagger.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the ParserTagger.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2003 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU Lesser General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | using System.Collections;
38 |
39 | namespace OpenNLP.Tools.Parser
40 | {
41 | ///
42 | /// Interface that a pos-tagger used by the parser must implement.
43 | ///
44 | public interface IParserTagger : PosTagger.IPosTagger
45 | {
46 | Util.Sequence[] TopKSequences(ArrayList sentence);
47 | Util.Sequence[] TopKSequences(string[] sentence);
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/PosTagger/EnglishMaximumEntropyPosTagger.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the EnglishPOSTaggerME.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | // Copyright (C) 2004 Jason Baldridge, Gann Bierner, and Tom Morton
21 | //
22 | // This library is free software; you can redistribute it and/or
23 | // modify it under the terms of the GNU Lesser General Public
24 | // License as published by the Free Software Foundation; either
25 | // version 2.1 of the License, or (at your option) any later version.
26 | //
27 | // This library is distributed in the hope that it will be useful,
28 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | // GNU Lesser General Public License for more details.
31 | //
32 | // You should have received a copy of the GNU Lesser General Public
33 | // License along with this program; if not, write to the Free Software
34 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 |
38 | namespace OpenNLP.Tools.PosTagger
39 | {
40 | ///
41 | /// A part of speech tagger that uses a model trained on English data from the
42 | /// Wall Street Journal and the Brown corpus. The latest model created
43 | /// achieved >96% accuracy on unseen data.
44 | ///
45 | public class EnglishMaximumEntropyPosTagger : MaximumEntropyPosTagger
46 | {
47 |
48 | public EnglishMaximumEntropyPosTagger(string modelFile, PosLookupList dictionary) : base(GetModel(modelFile), new DefaultPosContextGenerator(), dictionary)
49 | {
50 | }
51 |
52 | public EnglishMaximumEntropyPosTagger(string modelFile, string dictionary) : base(GetModel(modelFile), new DefaultPosContextGenerator(), new PosLookupList(dictionary))
53 | {
54 | }
55 |
56 | public EnglishMaximumEntropyPosTagger(string modelFile) : base(GetModel(modelFile), new DefaultPosContextGenerator())
57 | {
58 | }
59 |
60 | private static SharpEntropy.IMaximumEntropyModel GetModel(string name)
61 | {
62 | return new SharpEntropy.GisModel(new SharpEntropy.IO.BinaryGisModelReader(name));
63 | }
64 | }
65 |
66 | }
67 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/PosTagger/IPosContextGenerator.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the DefaultPOSContextGenerator.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | // Copyright (C) 2002 Jason Baldridge and Gann Bierner
21 | //
22 | // This library is free software; you can redistribute it and/or
23 | // modify it under the terms of the GNU Lesser General Public
24 | // License as published by the Free Software Foundation; either
25 | // version 2.1 of the License, or (at your option) any later version.
26 | //
27 | // This library is distributed in the hope that it will be useful,
28 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | // GNU Lesser General Public License for more details.
31 | //
32 | // You should have received a copy of the GNU Lesser General Public
33 | // License along with this program; if not, write to the Free Software
34 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | using System.Collections;
38 |
39 | namespace OpenNLP.Tools.PosTagger
40 | {
41 | ///
42 | /// The interface for a context generator for the POS Tagger.
43 | ///
44 | public interface IPosContextGenerator : Util.IBeamSearchContextGenerator
45 | {
46 | new string[] GetContext(int position, object[] tokens, string[] previousTags, object[] additionalContext);
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/PosTagger/IPosTagger.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the POSTagger.java source file found in the
18 | //original java implementation of OpenNLP.
19 |
20 | using System;
21 | using System.Collections;
22 |
23 | namespace OpenNLP.Tools.PosTagger
24 | {
25 | ///
26 | /// The interface for part of speech taggers.
27 | ///
28 | public interface IPosTagger
29 | {
30 | ///
31 | /// Assigns the sentence of tokens pos tags.
32 | ///
33 | ///
34 | /// The sentence of tokens to be tagged.
35 | ///
36 | ///
37 | /// a list of pos tags for each token provided in sentence.
38 | ///
39 | ArrayList Tag(ArrayList tokens);
40 |
41 | ///
42 | /// Assigns the sentence of tokens pos tags.
43 | ///
44 | /// The sentence of tokens to be tagged.
45 | ///
46 | ///
47 | /// an array of pos tags for each token provided in sentence.
48 | ///
49 | string[] Tag(string[] tokens);
50 |
51 | ///
52 | /// Assigns pos tags to the sentence of space-delimited tokens.
53 | ///
54 | ///
55 | /// The sentence of space-delimited tokens to be tagged.
56 | ///
57 | ///
58 | /// a string of space-delimited pos tags for each token provided in sentence.
59 | ///
60 | string TagSentence(string sentence);
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/SentenceDetect/EnglishMaximumEntropySentenceDetector.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the EnglishSentenceDetectorME.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | // Copyright (C) 2004 Jason Baldridge, Gann Bierner and Tom Morton
21 | //
22 | // This library is free software; you can redistribute it and/or
23 | // modify it under the terms of the GNU Lesser General Public
24 | // License as published by the Free Software Foundation; either
25 | // version 2.1 of the License, or (at your option) any later version.
26 | //
27 | // This library is distributed in the hope that it will be useful,
28 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | // GNU Lesser General Public License for more details.
31 | //
32 | // You should have received a copy of the GNU Lesser General Public
33 | // License along with this program; if not, write to the Free Software
34 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 |
38 | namespace OpenNLP.Tools.SentenceDetect
39 | {
40 | ///
41 | /// A sentence detector which uses a model trained on English data (Wall Street
42 | /// Journal text).
43 | ///
44 | public class EnglishMaximumEntropySentenceDetector : MaximumEntropySentenceDetector
45 | {
46 | ///
47 | /// Constructor which loads the English sentence detection model
48 | /// transparently.
49 | ///
50 | public EnglishMaximumEntropySentenceDetector(string name) : base(new SharpEntropy.GisModel(new SharpEntropy.IO.BinaryGisModelReader(name)))
51 | {
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/SentenceDetect/ISentenceDectector.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the SentenceDetector.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | // Copyright (C) 2002 Jason Baldridge and Gann Bierner
21 | //
22 | // This library is free software; you can redistribute it and/or
23 | // modify it under the terms of the GNU Lesser General Public
24 | // License as published by the Free Software Foundation; either
25 | // version 2.1 of the License, or (at your option) any later version.
26 | //
27 | // This library is distributed in the hope that it will be useful,
28 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | // GNU Lesser General Public License for more details.
31 | //
32 | // You should have received a copy of the GNU Lesser General Public
33 | // License along with this program; if not, write to the Free Software
34 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 |
38 | namespace OpenNLP.Tools.SentenceDetect
39 | {
40 | ///
41 | /// The interface for sentence detectors, which find the sentence boundaries in
42 | /// a text.
43 | ///
44 | public interface ISentenceDetector
45 | {
46 | ///
47 | /// Sentence detect a string.
48 | ///
49 | ///
50 | /// The string to be sentence detected.
51 | ///
52 | ///
53 | /// The string[] with the individual sentences as the array
54 | /// elements.
55 | ///
56 | string[] SentenceDetect(string input);
57 |
58 | ///
59 | /// Sentence detect a string.
60 | ///
61 | ///
62 | /// The string to be sentence detected.
63 | ///
64 | ///
65 | /// An int[] with the starting offset positions of each
66 | /// detected sentence.
67 | ///
68 | int[] SentencePositionDetect(string input);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/SentenceDetect/SentenceDetectionEvent.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the SDEvent.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | // Copyright (c) 2001, Eric D. Friedman All Rights Reserved.
21 | //
22 | // This library is free software; you can redistribute it and/or
23 | // modify it under the terms of the GNU Lesser General Public
24 | // License as published by the Free Software Foundation; either
25 | // version 2.1 of the License, or (at your option) any later version.
26 | //
27 | // This library is distributed in the hope that it will be useful,
28 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | // GNU Lesser General Public License for more details.
31 | //
32 | // You should have received a copy of the GNU Lesser General Public
33 | // License along with this program; if not, write to the Free Software
34 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 |
38 | namespace OpenNLP.Tools.SentenceDetect
39 | {
40 | ///
41 | /// An Event which can hold a pointer to another Event for use in a
42 | /// linked list.
43 | ///
44 | public class SentenceDetectionEvent : SharpEntropy.TrainingEvent
45 | {
46 | private SentenceDetectionEvent mNextEvent;
47 |
48 | internal SentenceDetectionEvent NextEvent
49 | {
50 | get
51 | {
52 | return mNextEvent;
53 | }
54 | set
55 | {
56 | mNextEvent = value;
57 | }
58 | }
59 |
60 | ///
61 | /// package access only
62 | ///
63 | internal SentenceDetectionEvent(string outcome, string[] context) : base(outcome, context)
64 | {
65 | }
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/Tokenize/EnglishMaximumEntropyTokenizer.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the EnglishTokenizerME.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | // Copyright (C) 2004 Jason Baldridge, Gann Bierner, and Tom Morton
21 | //
22 | // This library is free software; you can redistribute it and/or
23 | // modify it under the terms of the GNU Lesser General Public
24 | // License as published by the Free Software Foundation; either
25 | // version 2.1 of the License, or (at your option) any later version.
26 | //
27 | // This library is distributed in the hope that it will be useful,
28 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | // GNU Lesser General Public License for more details.
31 | //
32 | // You should have received a copy of the GNU Lesser General Public
33 | // License along with this program; if not, write to the Free Software
34 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 |
38 | namespace OpenNLP.Tools.Tokenize
39 | {
40 | ///
41 | /// A tokenizer which uses default English data for the maximum entropy model.
42 | ///
43 | public class EnglishMaximumEntropyTokenizer : MaximumEntropyTokenizer
44 | {
45 | public EnglishMaximumEntropyTokenizer(string name) : base(new SharpEntropy.GisModel(new SharpEntropy.IO.BinaryGisModelReader(name)))
46 | {
47 | AlphaNumericOptimization = true;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/Tokenize/ITokenizer.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the Tokenizer.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | // Copyright (C) 2002 Jason Baldridge and Gann Bierner
21 | //
22 | // This library is free software; you can redistribute it and/or
23 | // modify it under the terms of the GNU Lesser General Public
24 | // License as published by the Free Software Foundation; either
25 | // version 2.1 of the License, or (at your option) any later version.
26 | //
27 | // This library is distributed in the hope that it will be useful,
28 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | // GNU Lesser General Public License for more details.
31 | //
32 | // You should have received a copy of the GNU Lesser General Public
33 | // License along with this program; if not, write to the Free Software
34 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 |
38 | namespace OpenNLP.Tools.Tokenize
39 | {
40 | ///
41 | /// The interface for tokenizers, which turn messy text into nicely segmented
42 | /// text tokens.
43 | ///
44 | public interface ITokenizer
45 | {
46 | ///
47 | /// Tokenize a string.
48 | ///
49 | ///
50 | /// The string to be tokenized.
51 | ///
52 | ///
53 | /// The string[] with the individual tokens as the array
54 | /// elements.
55 | ///
56 | string[] Tokenize(string input);
57 |
58 | ///
59 | /// Tokenize a string.
60 | ///
61 | ///
62 | /// The string to be tokenized.
63 | ///
64 | ///
65 | /// The Span[] with the spans (offsets into input) for each
66 | /// token as the individuals array elements.
67 | ///
68 | Util.Span[] TokenizePositions(string input);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/Util/CollectionEventStream.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the CollectionEventStream.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2004 Thomas Morton
21 | //
22 | //This library is free software; you can redistribute it and/or
23 | //modify it under the terms of the GNU Lesser General Public
24 | //License as published by the Free Software Foundation; either
25 | //version 2.1 of the License, or (at your option) any later version.
26 | //
27 | //This library is distributed in the hope that it will be useful,
28 | //but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | //GNU General Public License for more details.
31 | //
32 | //You should have received a copy of the GNU Lesser General Public
33 | //License along with this program; if not, write to the Free Software
34 | //Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | using System.Collections;
38 |
39 | namespace OpenNLP.Tools.Util
40 | {
41 | ///
42 | /// Creates an event stream out of a collection of events.
43 | ///
44 | public class CollectionEventReader : SharpEntropy.ITrainingEventReader
45 | {
46 | private IEnumerator mCollection;
47 |
48 | public CollectionEventReader(ICollection c)
49 | {
50 | mCollection = c.GetEnumerator();
51 | }
52 |
53 | #region ITrainingEventReader Members
54 |
55 | public virtual bool HasNext()
56 | {
57 | return mCollection.MoveNext();
58 | }
59 |
60 | public SharpEntropy.TrainingEvent ReadNextEvent()
61 | {
62 | return (SharpEntropy.TrainingEvent)mCollection.Current;
63 | }
64 |
65 | #endregion
66 | }
67 | }
--------------------------------------------------------------------------------
/OpenNLP/Tools/Util/HashSet.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | using System;
18 | using System.Collections;
19 | using System.Collections.Generic;
20 |
21 | namespace OpenNLP.Tools.Util
22 | {
23 | ///
24 | /// This class manages a hash set of elements.
25 | ///
26 | public class HashSet : Set
27 | {
28 | ///
29 | /// Creates a new hash set collection.
30 | ///
31 | public HashSet()
32 | {
33 | }
34 |
35 | ///
36 | /// Creates a new hash set collection.
37 | ///
38 | ///
39 | /// The collection to initialize the hash set with.
40 | ///
41 | public HashSet(ICollection collection)
42 | {
43 | this.AddRange(collection);
44 | }
45 |
46 | ///
47 | /// Creates a new hash set with the given capacity.
48 | ///
49 | ///
50 | /// The initial capacity of the hash set.
51 | ///
52 | public HashSet(int capacity)
53 | {
54 | this.Capacity = capacity;
55 | }
56 |
57 | ///
58 | /// Creates a new hash set with the given capacity.
59 | ///
60 | ///
61 | /// The initial capacity of the hash set.
62 | ///
63 | ///
64 | /// The load factor of the hash set.
65 | ///
66 | public HashSet(int capacity, float loadFactor)
67 | {
68 | this.Capacity = capacity;
69 | }
70 |
71 | ///
72 | /// Creates a copy of the HashSet.
73 | ///
74 | /// A copy of the HashSet.
75 | public virtual object HashSetClone()
76 | {
77 | return MemberwiseClone();
78 | }
79 |
80 | public static Set EntrySet(IDictionary hashtable)
81 | {
82 | IDictionaryEnumerator hashEnumerator = hashtable.GetEnumerator();
83 | Set hashSet = new Set();
84 | while(hashEnumerator.MoveNext())
85 | {
86 | Hashtable hash = new Hashtable();
87 | hash.Add(hashEnumerator.Key, hashEnumerator.Value);
88 | hashSet.Add(hash.GetEnumerator());
89 | }
90 | return hashSet;
91 | }
92 | }
93 | }
94 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/Util/IBeamSearchContextGenerator.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the BeamSearchContextGenerator.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | //Copyright (C) 2004 Thomas Morton
21 | //
22 | // This library is free software; you can redistribute it and/or
23 | // modify it under the terms of the GNU Lesser General Public
24 | // License as published by the Free Software Foundation; either
25 | // version 2.1 of the License, or (at your option) any later version.
26 | //
27 | // This library is distributed in the hope that it will be useful,
28 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | // GNU Lesser General Public License for more details.
31 | //
32 | // You should have received a copy of the GNU Lesser General Public
33 | // License along with this program; if not, write to the Free Software
34 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 | using System.Collections;
38 |
39 | namespace OpenNLP.Tools.Util
40 | {
41 | ///
42 | /// Interface for a context generator that uses a beam search.
43 | ///
44 | public interface IBeamSearchContextGenerator : SharpEntropy.IContextGenerator
45 | {
46 | ///
47 | /// Returns the context for the specified position in the specified sequence (list).
48 | ///
49 | /// The index of the sequence.
50 | ///
51 | ///
52 | /// The sequence of items over which the beam search is performed.
53 | ///
54 | ///
55 | /// The sequence of decisions made prior to the context for which this decision is being made.
56 | ///
57 | ///
58 | /// Any addition context specific to a class implementing this interface.
59 | ///
60 | ///
61 | /// the context for the specified position in the specified sequence.
62 | ///
63 | string[] GetContext(int index, object[] sequence, string[] priorDecisions, object[] additionalContext);
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/Util/Pair.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the Pair.java source file found in the
18 | //original java implementation of OpenNLP. That source file contains the following header:
19 |
20 | // Copyright (C) 2002 Jason Baldridge and Gann Bierner
21 | //
22 | // This library is free software; you can redistribute it and/or
23 | // modify it under the terms of the GNU Lesser General Public
24 | // License as published by the Free Software Foundation; either
25 | // version 2.1 of the License, or (at your option) any later version.
26 | //
27 | // This library is distributed in the hope that it will be useful,
28 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
29 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
30 | // GNU Lesser General Public License for more details.
31 | //
32 | // You should have received a copy of the GNU Lesser General Public
33 | // License along with this program; if not, write to the Free Software
34 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
35 |
36 | using System;
37 |
38 | namespace OpenNLP.Tools.Util
39 | {
40 | ///
41 | /// Dinky class to package pairs of things
42 | ///
43 | public sealed class Pair
44 | {
45 | private A mFirst;
46 | private B mSecond;
47 |
48 | ///
49 | /// Value of the first object in the Pair.
50 | ///
51 | public A FirstValue
52 | {
53 | get
54 | {
55 | return mFirst;
56 | }
57 | }
58 |
59 | ///
60 | /// Value of the second object in the Pair.
61 | ///
62 | public B SecondValue
63 | {
64 | get
65 | {
66 | return mSecond;
67 | }
68 | }
69 |
70 | ///
71 | /// Constructor for the Pair object.
72 | ///
73 | ///
74 | /// First object to add to the Pair.
75 | ///
76 | ///
77 | /// Second object to add to the Pair.
78 | ///
79 | public Pair(A first, B second)
80 | {
81 | mFirst = first;
82 | mSecond = second;
83 | }
84 |
85 | ///
86 | /// Lists the values of the Pair object.
87 | ///
88 | ///
89 | /// String value.
90 | ///
91 | public override string ToString()
92 | {
93 | return "[" + mFirst.ToString() + "/" + mSecond.ToString() + "]";
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/Util/StringTokenizer.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | using System;
18 |
19 | namespace OpenNLP.Tools.Util
20 | {
21 | ///
22 | /// Class providing simple tokenization of a string, for manipulation.
23 | /// For NLP tokenizing, see the OpenNLP.Tools.Tokenize namespace.
24 | ///
25 | public class StringTokenizer
26 | {
27 | private const string mDelimiters = " \t\n\r"; //The tokenizer uses the default delimiter set: the space character, the tab character, the newline character, and the carriage-return character
28 | private string[] mTokens;
29 | int mPosition;
30 |
31 | ///
32 | /// Initializes a new class instance with a specified string to process
33 | ///
34 | ///
35 | /// String to tokenize
36 | ///
37 | public StringTokenizer(string input) : this(input, mDelimiters.ToCharArray())
38 | {
39 | }
40 |
41 | public StringTokenizer(string input, string separators) : this(input, separators.ToCharArray())
42 | {
43 | }
44 |
45 | public StringTokenizer(string input, params char[] separators)
46 | {
47 | mTokens = input.Split(separators);
48 | mPosition = 0;
49 | }
50 |
51 | public string NextToken()
52 | {
53 | while (mPosition < mTokens.Length)
54 | {
55 | if ((mTokens[mPosition].Length > 0))
56 | {
57 | return mTokens[mPosition++];
58 | }
59 | mPosition++;
60 | }
61 | return null;
62 | }
63 |
64 | }
65 | }
66 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/Util/TreeHeap.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the TreeHeap.java source file found in the
18 | //original java implementation of OpenNLP.
19 |
20 | using System;
21 |
22 | namespace OpenNLP.Tools.Util
23 | {
24 | ///
25 | /// An implemention of the heap interface based on SortedSet.
26 | /// This implementation will not allow multiple objects which are equal to be added to the heap.
27 | /// Only use this implementation when object in the heap can be totally ordered (no duplicates).
28 | ///
29 | public class TreeHeap : IHeap
30 | {
31 |
32 | private SortedSet mTree;
33 |
34 | /// Creates a new tree heap.
35 | public TreeHeap()
36 | {
37 | mTree = new TreeSet();
38 | }
39 |
40 | ///
41 | /// Creates a new tree heap of the specified size.
42 | ///
43 | ///
44 | /// The size of the new tree heap.
45 | ///
46 | public TreeHeap(int size)
47 | {
48 | mTree = new TreeSet();
49 | }
50 |
51 | public virtual T Extract()
52 | {
53 | T extracted = mTree.First();
54 | mTree.Remove(extracted);
55 | return extracted;
56 | }
57 |
58 | public virtual T Top
59 | {
60 | get
61 | {
62 | return mTree.First();
63 | }
64 | }
65 |
66 | public virtual void Add(T input)
67 | {
68 | mTree.Add(input);
69 | }
70 |
71 | public void Sort()
72 | {
73 | mTree.Sort();
74 | }
75 |
76 | public virtual int Size
77 | {
78 | get
79 | {
80 | return mTree.Count;
81 | }
82 | }
83 |
84 | public virtual void Clear()
85 | {
86 | mTree.Clear();
87 | }
88 |
89 | public virtual bool IsEmpty
90 | {
91 | get
92 | {
93 | return mTree.IsEmpty();
94 | }
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/OpenNLP/Tools/Util/TreeSet.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2005 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | using System;
18 | using System.Collections.Generic;
19 |
20 | namespace OpenNLP.Tools.Util
21 | {
22 | ///
23 | /// This class manages a tree set collection of sorted elements.
24 | ///
25 | public class TreeSet : SortedSet
26 | {
27 | ///
28 | /// Creates a new TreeSet.
29 | ///
30 | public TreeSet()
31 | {
32 | }
33 |
34 | ///
35 | /// Create a new TreeSet with a specific collection.
36 | ///
37 | ///
38 | /// The collection used to initialize the TreeSet
39 | ///
40 | public TreeSet(ICollection collection): base(collection)
41 | {
42 | }
43 |
44 | ///
45 | /// Creates a copy of the TreeSet.
46 | ///
47 | /// A copy of the TreeSet.
48 | public virtual object TreeSetClone()
49 | {
50 | TreeSet internalClone = new TreeSet();
51 | internalClone.AddAll(this);
52 | return internalClone;
53 | }
54 |
55 | ///
56 | /// Retrieves the number of elements contained in the set.
57 | ///
58 | ///
59 | /// An integer value that represent the number of element in the set.
60 | ///
61 | public virtual int Size()
62 | {
63 | return this.Count;
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/OpenNLP/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/OpenNLP/models/Coref.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref.zip
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/cmodel.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/cmodel.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/cmodel_nr.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/cmodel_nr.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/defmodel.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/defmodel.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/defmodel_nr.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/defmodel_nr.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/fmodel.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/fmodel.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/fmodel_nr.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/fmodel_nr.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/gen.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/gen.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/imodel.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/imodel.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/imodel_nr.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/imodel_nr.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/num.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/num.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/plmodel.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/plmodel.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/plmodel_nr.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/plmodel_nr.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/pmodel.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/pmodel.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/pmodel_nr.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/pmodel_nr.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/pnmodel.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/pnmodel.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/pnmodel_nr.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/pnmodel_nr.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/sim.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/sim.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/tmodel.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/tmodel.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Coref/tmodel_nr.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Coref/tmodel_nr.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/EnglishChunk.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/EnglishChunk.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/EnglishPOS.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/EnglishPOS.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/EnglishSD.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/EnglishSD.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/EnglishTok.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/EnglishTok.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/NameFind/date.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/NameFind/date.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/NameFind/location.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/NameFind/location.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/NameFind/money.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/NameFind/money.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/NameFind/organization.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/NameFind/organization.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/NameFind/percentage.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/NameFind/percentage.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/NameFind/person.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/NameFind/person.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/NameFind/time.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/NameFind/time.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Parser/build.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Parser/build.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Parser/check.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Parser/check.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Parser/chunk.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Parser/chunk.nbin
--------------------------------------------------------------------------------
/OpenNLP/models/Parser/head_rules:
--------------------------------------------------------------------------------
1 | 20 ADJP 0 NNS QP NN $ ADVP JJ VBN VBG ADJP JJR NP JJS DT FW RBR RBS SBAR RB
2 | 15 ADVP 1 RB RBR RBS FW ADVP TO CD JJR JJ IN NP JJS NN
3 | 5 CONJP 1 CC RB IN
4 | 2 FRAG 1
5 | 2 INTJ 0
6 | 4 LST 1 LS :
7 | 19 NAC 0 NN NNS NNP NNPS NP NAC EX $ CD QP PRP VBG JJ JJS JJR ADJP FW
8 | 8 PP 1 IN TO VBG VBN RP FW
9 | 2 PRN 1
10 | 3 PRT 1 RP
11 | 14 QP 0 $ IN NNS NN JJ RB DT CD NCD QP JJR JJS
12 | 7 RRC 1 VP NP ADVP ADJP PP
13 | 10 S 0 TO IN VP S SBAR ADJP UCP NP
14 | 13 SBAR 0 WHNP WHPP WHADVP WHADJP IN DT S SQ SINV SBAR FRAG
15 | 7 SBARQ 0 SQ S SINV SBARQ FRAG
16 | 12 SINV 0 VBZ VBD VBP VB MD VP S SINV ADJP NP
17 | 9 SQ 0 VBZ VBD VBP VB MD VP SQ
18 | 2 UCP 1
19 | 15 VP 1 TO VBD VBN MD VBZ VB VBG VBP VP ADJP NN NNS NP
20 | 6 WHADJP 0 CC WRB JJ ADJP
21 | 4 WHADVP 1 CC WRB
22 | 8 WHNP 0 WDT WP WP$ WHADJP WHPP WHNP
23 | 5 WHPP 1 IN TO FW
24 | 2 X 1
25 |
--------------------------------------------------------------------------------
/OpenNLP/models/Parser/tag.nbin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/OpenNLP/models/Parser/tag.nbin
--------------------------------------------------------------------------------
/OpenNLP/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ParseTree/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/ParseTree/App.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/ParseTree/App.ico
--------------------------------------------------------------------------------
/ParseTree/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | //
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | //
9 | [assembly: AssemblyTitle("")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("")]
14 | [assembly: AssemblyCopyright("")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | //
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Revision and Build Numbers
27 | // by using the '*' as shown below:
28 |
29 | [assembly: AssemblyVersion("1.0.*")]
30 |
31 | //
32 | // In order to sign your assembly you must specify a key to use. Refer to the
33 | // Microsoft .NET Framework documentation for more information on assembly signing.
34 | //
35 | // Use the attributes below to control which key is used for signing.
36 | //
37 | // Notes:
38 | // (*) If no key is specified, the assembly is not signed.
39 | // (*) KeyName refers to a key that has been installed in the Crypto Service
40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains
41 | // a key.
42 | // (*) If the KeyFile and the KeyName values are both specified, the
43 | // following processing occurs:
44 | // (1) If the KeyName can be found in the CSP, that key is used.
45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key
46 | // in the KeyFile is installed into the CSP and used.
47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
48 | // When specifying the KeyFile, the location of the KeyFile should be
49 | // relative to the project output directory which is
50 | // %Project Directory%\obj\. For example, if your KeyFile is
51 | // located in the project directory, you would specify the AssemblyKeyFile
52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
54 | // documentation for more information on this.
55 | //
56 | [assembly: AssemblyDelaySign(false)]
57 | [assembly: AssemblyKeyFile("")]
58 | [assembly: AssemblyKeyName("")]
59 |
--------------------------------------------------------------------------------
/ParseTree/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/SharpWordNet/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | //
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | //
9 | [assembly: AssemblyTitle("")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("")]
14 | [assembly: AssemblyCopyright("")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | //
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Revision and Build Numbers
27 | // by using the '*' as shown below:
28 |
29 | [assembly: AssemblyVersion("1.0.*")]
30 |
31 | //
32 | // In order to sign your assembly you must specify a key to use. Refer to the
33 | // Microsoft .NET Framework documentation for more information on assembly signing.
34 | //
35 | // Use the attributes below to control which key is used for signing.
36 | //
37 | // Notes:
38 | // (*) If no key is specified, the assembly is not signed.
39 | // (*) KeyName refers to a key that has been installed in the Crypto Service
40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains
41 | // a key.
42 | // (*) If the KeyFile and the KeyName values are both specified, the
43 | // following processing occurs:
44 | // (1) If the KeyName can be found in the CSP, that key is used.
45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key
46 | // in the KeyFile is installed into the CSP and used.
47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
48 | // When specifying the KeyFile, the location of the KeyFile should be
49 | // relative to the project output directory which is
50 | // %Project Directory%\obj\. For example, if your KeyFile is
51 | // located in the project directory, you would specify the AssemblyKeyFile
52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
54 | // documentation for more information on this.
55 | //
56 | [assembly: AssemblyDelaySign(false)]
57 | [assembly: AssemblyKeyFile("")]
58 | [assembly: AssemblyKeyName("")]
59 |
--------------------------------------------------------------------------------
/SharpWordNet/IndexWord.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | using System;
18 |
19 | namespace SharpWordNet
20 | {
21 | ///
22 | /// Summary description for IndexWord.
23 | ///
24 | public class IndexWord
25 | {
26 | private string mLemma;
27 | private string mPartOfSpeech;
28 | private string[] mRelationTypes = null;
29 | private int mTagSenseCount = 0;
30 | private int[] mSynsetOffsets = null;
31 |
32 | public int[] SynsetOffsets
33 | {
34 | get
35 | {
36 | return mSynsetOffsets;
37 | }
38 | }
39 |
40 | public string Lemma
41 | {
42 | get
43 | {
44 | return mLemma;
45 | }
46 | }
47 |
48 | public int SenseCount
49 | {
50 | get
51 | {
52 | if (mSynsetOffsets == null)
53 | {
54 | return 0;
55 | }
56 | else
57 | {
58 | return mSynsetOffsets.Length;
59 | }
60 | }
61 | }
62 |
63 | public int TagSenseCount
64 | {
65 | get
66 | {
67 | return mTagSenseCount;
68 | }
69 | }
70 |
71 | public string[] RelationTypes
72 | {
73 | get
74 | {
75 | return mRelationTypes;
76 | }
77 | }
78 |
79 | public IndexWord(string lemma, string partOfSpeech, string[] relationTypes, int[] synsetOffsets, int tagSenseCount)
80 | {
81 | mLemma = lemma;
82 | mPartOfSpeech = partOfSpeech;
83 | mRelationTypes = relationTypes;
84 | mSynsetOffsets = synsetOffsets;
85 | mTagSenseCount = tagSenseCount;
86 | }
87 | }
88 | }
89 |
--------------------------------------------------------------------------------
/SharpWordNet/Morph/AbstractDelegatingOperation.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the AbstractDelegatingOperation.java source file found in
18 | //the Java WordNet Library (JWNL). That source file is licensed under BSD.
19 |
20 | using System;
21 | using System.Collections.Generic;
22 | using System.Text;
23 |
24 | namespace SharpWordNet.Morph
25 | {
26 | public abstract class AbstractDelegatingOperation : IOperation
27 | {
28 | private Dictionary mOperationSets;
29 |
30 | public virtual void AddDelegate(string key, IOperation[] operations)
31 | {
32 | if (!mOperationSets.ContainsKey(key))
33 | {
34 | mOperationSets.Add(key, operations);
35 | }
36 | else
37 | {
38 | mOperationSets[key] = operations;
39 | }
40 | }
41 |
42 | protected internal AbstractDelegatingOperation()
43 | {
44 | mOperationSets = new Dictionary();
45 | }
46 |
47 | //protected internal abstract AbstractDelegatingOperation getInstance(System.Collections.IDictionary params_Renamed);
48 |
49 | protected internal virtual bool HasDelegate(string key)
50 | {
51 | return mOperationSets.ContainsKey(key);
52 | }
53 |
54 | protected internal virtual bool ExecuteDelegate(string lemma, string partOfSpeech, ListbaseForms, string key)
55 | {
56 | IOperation[] operations = mOperationSets[key];
57 | bool result = false;
58 | for (int currentOperation = 0; currentOperation < operations.Length; currentOperation++)
59 | {
60 | if (operations[currentOperation].Execute(lemma, partOfSpeech, baseForms))
61 | {
62 | result = true;
63 | }
64 | }
65 | return result;
66 | }
67 |
68 | #region IOperation Members
69 |
70 | public abstract bool Execute(string lemma, string partOfSpeech, List baseForms);
71 |
72 | #endregion
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/SharpWordNet/Morph/DetachSuffixesOperation.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the DetachSuffixesOperation.java source file found in
18 | //the Java WordNet Library (JWNL). That source file is licensed under BSD.
19 |
20 | using System;
21 | using System.Collections.Generic;
22 | using System.Text;
23 |
24 | namespace SharpWordNet.Morph
25 | {
26 | ///
27 | /// Remove all applicable suffixes from the word(s) and do a look-up.
28 | ///
29 | public class DetachSuffixesOperation : AbstractDelegatingOperation
30 | {
31 | public const string Operations = "operations";
32 |
33 | private Dictionary mSuffixMap;
34 |
35 | public DetachSuffixesOperation(Dictionary suffixMap)
36 | {
37 | mSuffixMap = suffixMap;
38 | }
39 |
40 | #region IOperation Members
41 |
42 | public override bool Execute(string lemma, string partOfSpeech, List baseForms)
43 | {
44 | if (!mSuffixMap.ContainsKey(partOfSpeech))
45 | {
46 | return false;
47 | }
48 | string[][] suffixArray = mSuffixMap[partOfSpeech];
49 |
50 | bool addedBaseForm = false;
51 | for (int currentSuffix = 0; currentSuffix < suffixArray.Length; currentSuffix++)
52 | {
53 | if (lemma.EndsWith(suffixArray[currentSuffix][0]))
54 | {
55 | string stem = lemma.Substring(0, (lemma.Length - suffixArray[currentSuffix][0].Length) - (0)) + suffixArray[currentSuffix][1];
56 | if (ExecuteDelegate(stem, partOfSpeech, baseForms, Operations))
57 | {
58 | addedBaseForm = true;
59 | }
60 | }
61 | }
62 | return addedBaseForm;
63 | }
64 |
65 | #endregion
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/SharpWordNet/Morph/IOperation.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the Operation.java source file found in
18 | //the Java WordNet Library (JWNL). That source file is licensed under BSD.
19 |
20 | using System;
21 | using System.Collections.Generic;
22 | using System.Text;
23 |
24 | namespace SharpWordNet.Morph
25 | {
26 | public interface IOperation
27 | {
28 | ///
29 | /// Execute the operation.
30 | ///
31 | ///
32 | /// input lemma to look up
33 | ///
34 | ///
35 | /// part of speech of the lemma to look up
36 | ///
37 | ///
38 | /// List to which all discovered base forms should be added.
39 | ///
40 | ///
41 | /// True if at least one base form was discovered by the operation and
42 | /// added to baseForms.
43 | ///
44 | bool Execute(string lemma, string partOfSpeech, List baseForms);
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/SharpWordNet/Morph/LookupExceptionsOperation.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the LookupExceptionsOperation.java source file found in
18 | //the Java WordNet Library (JWNL). That source file is licensed under BSD.
19 |
20 | using System;
21 | using System.Collections.Generic;
22 | using System.Text;
23 |
24 | namespace SharpWordNet.Morph
25 | {
26 | /// Lookup the word in the exceptions file of the given part-of-speech.
27 | public class LookupExceptionsOperation : IOperation
28 | {
29 | private WordNetEngine mEngine;
30 |
31 | public LookupExceptionsOperation(WordNetEngine engine)
32 | {
33 | mEngine = engine;
34 | }
35 |
36 | #region IOperation Members
37 |
38 | public bool Execute(string lemma, string partOfSpeech, List baseForms)
39 | {
40 | bool addedBaseForm = false;
41 | string[] exceptionForms = mEngine.GetExceptionForms(lemma, partOfSpeech);
42 |
43 | foreach (string exceptionForm in exceptionForms)
44 | {
45 | if (!baseForms.Contains(exceptionForm))
46 | {
47 | baseForms.Add(exceptionForm);
48 | addedBaseForm = true;
49 | }
50 | }
51 |
52 | return addedBaseForm;
53 | }
54 |
55 | #endregion
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/SharpWordNet/Morph/LookupIndexWordOperation.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the LookupIndexWordOperation.java source file found in
18 | //the Java WordNet Library (JWNL). That source file is licensed under BSD.
19 |
20 | using System;
21 | using System.Collections.Generic;
22 | using System.Text;
23 |
24 | namespace SharpWordNet.Morph
25 | {
26 | public class LookupIndexWordOperation : IOperation
27 | {
28 | private WordNetEngine mEngine;
29 |
30 | public LookupIndexWordOperation(WordNetEngine engine)
31 | {
32 | mEngine = engine;
33 | }
34 |
35 | #region IOperation Members
36 |
37 | public bool Execute(string lemma, string partOfSpeech, List baseForms)
38 | {
39 | if (!baseForms.Contains(lemma) && mEngine.GetIndexWord(lemma, partOfSpeech) != null)
40 | {
41 | baseForms.Add(lemma);
42 | return true;
43 | }
44 | return false;
45 | }
46 |
47 | #endregion
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/SharpWordNet/Morph/Util.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | //This file is based on the Util.java source file found in
18 | //the Java WordNet Library (JWNL). That source file is licensed under BSD.
19 |
20 | using System;
21 | using System.Collections;
22 | using System.Collections.Generic;
23 | using System.Text;
24 |
25 | namespace SharpWordNet.Morph
26 | {
27 | public class Util
28 | {
29 | public static string GetLemma(string[] tokens, BitArray bits, string delimiter)
30 | {
31 | StringBuilder buf = new StringBuilder();
32 | for (int i = 0; i < tokens.Length; i++)
33 | {
34 | if (i != 0 && !bits.Get(i - 1))
35 | {
36 | buf.Append(delimiter);
37 | }
38 | buf.Append(tokens[i]);
39 | }
40 | return buf.ToString();
41 | }
42 |
43 | public static bool Increment(BitArray bits, int size)
44 | {
45 | int i = size - 1;
46 | while (i >= 0 && bits.Get(i))
47 | {
48 | bits.Set(i--, false);
49 | }
50 | if (i < 0)
51 | {
52 | return false;
53 | }
54 | bits.Set(i, true);
55 | return true;
56 | }
57 |
58 | public static string[] Split(string str)
59 | {
60 | char[] chars = str.ToCharArray();
61 | List tokens = new List();
62 | StringBuilder buf = new StringBuilder();
63 | for (int i = 0; i < chars.Length; i++)
64 | {
65 | if ((chars[i] >= 'a' && chars[i] <= 'z') || chars[i] == '\'')
66 | {
67 | buf.Append(chars[i]);
68 | }
69 | else
70 | {
71 | if (buf.Length > 0)
72 | {
73 | tokens.Add(buf.ToString());
74 | buf = new StringBuilder();
75 | }
76 | }
77 | }
78 | if (buf.Length > 0)
79 | {
80 | tokens.Add(buf.ToString());
81 | }
82 | return (tokens.ToArray());
83 | }
84 |
85 | private Util()
86 | {
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/SharpWordNet/Relation.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | using System;
18 |
19 | namespace SharpWordNet
20 | {
21 | ///
22 | /// Summary description for Relation.
23 | ///
24 | public class Relation
25 | {
26 | private WordNetEngine mWordNetEngine;
27 |
28 | private RelationType mRelationType;
29 |
30 | private int mTargetSynsetOffset;
31 | private string mTargetSynsetPartOfSpeech;
32 |
33 | private Synset mTargetSynset;
34 |
35 | private int miSourceWord;
36 | private int miTargetWord;
37 |
38 | public RelationType SynsetRelationType
39 | {
40 | get
41 | {
42 | return mRelationType;
43 | }
44 | }
45 |
46 | public int TargetSynsetOffset
47 | {
48 | get
49 | {
50 | return mTargetSynsetOffset;
51 | }
52 | }
53 |
54 | public Synset TargetSynset
55 | {
56 | get
57 | {
58 | if (mTargetSynset == null)
59 | {
60 | mTargetSynset = mWordNetEngine.CreateSynset(mTargetSynsetPartOfSpeech, mTargetSynsetOffset);
61 | }
62 | return mTargetSynset;
63 | }
64 | }
65 |
66 | private Relation()
67 | {
68 | }
69 |
70 | protected internal Relation(WordNetEngine wordNetEngine, RelationType relationType, int targetSynsetOffset, string targetSynsetPartOfSpeech)
71 | {
72 | mWordNetEngine = wordNetEngine;
73 | mRelationType = relationType;
74 |
75 | mTargetSynsetOffset = targetSynsetOffset;
76 | mTargetSynsetPartOfSpeech = targetSynsetPartOfSpeech;
77 | }
78 |
79 | protected internal Relation(WordNetEngine wordNetEngine, RelationType relationType, int targetSynsetOffset, string targetSynsetPartOfSpeech, int sourceWord, int targetWord) : this(wordNetEngine, relationType, targetSynsetOffset, targetSynsetPartOfSpeech)
80 | {
81 | miSourceWord = sourceWord;
82 | miTargetWord = targetWord;
83 | }
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/SharpWordNet/RelationType.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | using System;
18 |
19 | namespace SharpWordNet
20 | {
21 | ///
22 | /// Summary description for RelationType.
23 | ///
24 | public class RelationType
25 | {
26 | private string mName;
27 | private RelationType mOpposite;
28 | private string[] mPartsOfSpeech;
29 |
30 | public string Name
31 | {
32 | get
33 | {
34 | return mName;
35 | }
36 | }
37 |
38 | public RelationType Opposite
39 | {
40 | get
41 | {
42 | return mOpposite;
43 | }
44 | }
45 |
46 | public string GetPartOfSpeech(int index)
47 | {
48 | return mPartsOfSpeech[index];
49 | }
50 |
51 | public int PartsOfSpeechCount
52 | {
53 | get
54 | {
55 | return mPartsOfSpeech.Length;
56 | }
57 | }
58 |
59 | protected internal RelationType(string name, string[] partsOfSpeech)
60 | {
61 | mName = name;
62 | mPartsOfSpeech = partsOfSpeech;
63 | }
64 |
65 | protected internal RelationType(string name, RelationType opposite, string[] partsOfSpeech)
66 | {
67 | mName = name;
68 | mOpposite = opposite;
69 | mPartsOfSpeech = partsOfSpeech;
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/SharpWordNet/SharpWordNet.sln:
--------------------------------------------------------------------------------
1 | Microsoft Visual Studio Solution File, Format Version 9.00
2 | # Visual Studio 2005
3 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharpWordNet", "SharpWordNet.csproj", "{4C78C577-D001-45EA-9893-F5570BAB16C0}"
4 | EndProject
5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestHarness", "TestHarness\TestHarness.csproj", "{57809E99-DF27-41AC-8877-19E348A2B29F}"
6 | EndProject
7 | Global
8 | GlobalSection(TeamFoundationVersionControl) = preSolution
9 | SccNumberOfProjects = 3
10 | SccEnterpriseProvider = {4CA58AB2-18FA-4F8D-95D4-32DDF27D184C}
11 | SccTeamFoundationServer = https://tfs01.codeplex.com/
12 | SccLocalPath0 = .
13 | SccProjectUniqueName1 = SharpWordNet.csproj
14 | SccLocalPath1 = .
15 | SccProjectUniqueName2 = TestHarness\\TestHarness.csproj
16 | SccProjectName2 = TestHarness
17 | SccLocalPath2 = TestHarness
18 | EndGlobalSection
19 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
20 | Debug|Any CPU = Debug|Any CPU
21 | Release|Any CPU = Release|Any CPU
22 | EndGlobalSection
23 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
24 | {4C78C577-D001-45EA-9893-F5570BAB16C0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25 | {4C78C577-D001-45EA-9893-F5570BAB16C0}.Debug|Any CPU.Build.0 = Debug|Any CPU
26 | {4C78C577-D001-45EA-9893-F5570BAB16C0}.Release|Any CPU.ActiveCfg = Release|Any CPU
27 | {4C78C577-D001-45EA-9893-F5570BAB16C0}.Release|Any CPU.Build.0 = Release|Any CPU
28 | {57809E99-DF27-41AC-8877-19E348A2B29F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29 | {57809E99-DF27-41AC-8877-19E348A2B29F}.Debug|Any CPU.Build.0 = Debug|Any CPU
30 | {57809E99-DF27-41AC-8877-19E348A2B29F}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 | {57809E99-DF27-41AC-8877-19E348A2B29F}.Release|Any CPU.Build.0 = Release|Any CPU
32 | EndGlobalSection
33 | GlobalSection(SolutionProperties) = preSolution
34 | HideSolutionNode = FALSE
35 | EndGlobalSection
36 | EndGlobal
37 |
--------------------------------------------------------------------------------
/SharpWordNet/Synset.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | using System;
18 |
19 | namespace SharpWordNet
20 | {
21 | ///
22 | /// Summary description for Synset.
23 | ///
24 | public class Synset
25 | {
26 | private int mOffset;
27 | private string mGloss;
28 | private string[] mWordList;
29 | private string mLexicographerFile;
30 | private Relation[] mRelations;
31 |
32 | private Synset()
33 | {
34 | }
35 |
36 | internal Synset(int offset, string gloss, string[] wordList, string lexicographerFile, Relation[] relations)
37 | {
38 | mOffset = offset;
39 | mGloss = gloss;
40 | mWordList = wordList;
41 | mLexicographerFile = lexicographerFile;
42 | mRelations = relations;
43 | }
44 |
45 | public int Offset
46 | {
47 | get
48 | {
49 | return mOffset;
50 | }
51 | }
52 |
53 | public string Gloss
54 | {
55 | get
56 | {
57 | return mGloss;
58 | }
59 | }
60 |
61 | public string GetWord(int wordIndex)
62 | {
63 | return mWordList[wordIndex];
64 | }
65 |
66 | public int WordCount
67 | {
68 | get
69 | {
70 | return mWordList.Length;
71 | }
72 | }
73 |
74 | public string LexicographerFile
75 | {
76 | get
77 | {
78 | return mLexicographerFile;
79 | }
80 | }
81 |
82 | public Relation GetRelation(int relationIndex)
83 | {
84 | return mRelations[relationIndex];
85 | }
86 |
87 | public int RelationCount
88 | {
89 | get
90 | {
91 | return mRelations.Length;
92 | }
93 | }
94 |
95 | public override string ToString()
96 | {
97 | System.Text.StringBuilder oOutput = new System.Text.StringBuilder();
98 |
99 | for (int iCurrentWord = 0; iCurrentWord < mWordList.Length; iCurrentWord++)
100 | {
101 | oOutput.Append(mWordList[iCurrentWord]);
102 | if (iCurrentWord < mWordList.Length - 1)
103 | {
104 | oOutput.Append(", ");
105 | }
106 | }
107 |
108 | oOutput.Append(" -- ").Append(mGloss);
109 |
110 | return oOutput.ToString();
111 | }
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/SharpWordNet/TestHarness/App.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/SharpWordNet/TestHarness/App.ico
--------------------------------------------------------------------------------
/SharpWordNet/TestHarness/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | //
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | //
9 | [assembly: AssemblyTitle("")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("")]
14 | [assembly: AssemblyCopyright("")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | //
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Revision and Build Numbers
27 | // by using the '*' as shown below:
28 |
29 | [assembly: AssemblyVersion("1.0.*")]
30 |
31 | //
32 | // In order to sign your assembly you must specify a key to use. Refer to the
33 | // Microsoft .NET Framework documentation for more information on assembly signing.
34 | //
35 | // Use the attributes below to control which key is used for signing.
36 | //
37 | // Notes:
38 | // (*) If no key is specified, the assembly is not signed.
39 | // (*) KeyName refers to a key that has been installed in the Crypto Service
40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains
41 | // a key.
42 | // (*) If the KeyFile and the KeyName values are both specified, the
43 | // following processing occurs:
44 | // (1) If the KeyName can be found in the CSP, that key is used.
45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key
46 | // in the KeyFile is installed into the CSP and used.
47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
48 | // When specifying the KeyFile, the location of the KeyFile should be
49 | // relative to the project output directory which is
50 | // %Project Directory%\obj\. For example, if your KeyFile is
51 | // located in the project directory, you would specify the AssemblyKeyFile
52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
54 | // documentation for more information on this.
55 | //
56 | [assembly: AssemblyDelaySign(false)]
57 | [assembly: AssemblyKeyFile("")]
58 | [assembly: AssemblyKeyName("")]
59 |
--------------------------------------------------------------------------------
/SharpWordNet/Tokenizer.cs:
--------------------------------------------------------------------------------
1 | //Copyright (C) 2006 Richard J. Northedge
2 | //
3 | // This library is free software; you can redistribute it and/or
4 | // modify it under the terms of the GNU Lesser General Public
5 | // License as published by the Free Software Foundation; either
6 | // version 2.1 of the License, or (at your option) any later version.
7 | //
8 | // This library is distributed in the hope that it will be useful,
9 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | // GNU Lesser General Public License for more details.
12 | //
13 | // You should have received a copy of the GNU Lesser General Public
14 | // License along with this program; if not, write to the Free Software
15 | // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16 |
17 | using System;
18 |
19 | namespace SharpWordNet
20 | {
21 | ///
22 | /// Summary description for Tokenizer.
23 | ///
24 | public class Tokenizer
25 | {
26 | private string[] mTokens;
27 | int mPosition;
28 |
29 | public Tokenizer(string input, params char[] separators)
30 | {
31 | mTokens = input.Split(separators);
32 | mPosition = 0;
33 | }
34 |
35 | public string NextToken()
36 | {
37 | while (mPosition < mTokens.Length)
38 | {
39 | if ((mTokens[mPosition].Length > 0))
40 | {
41 | return mTokens[mPosition++];
42 | }
43 | mPosition++;
44 | }
45 | return null;
46 | }
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/SharpWordNet/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/SharpWordNet/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ToolsExample/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/ToolsExample/App.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/dgerding/SharpNLP/2eefeda895084506bba48f712ea789e8fea1d0d3/ToolsExample/App.ico
--------------------------------------------------------------------------------
/ToolsExample/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 |
4 | //
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | //
9 | [assembly: AssemblyTitle("")]
10 | [assembly: AssemblyDescription("")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("")]
13 | [assembly: AssemblyProduct("")]
14 | [assembly: AssemblyCopyright("")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 |
18 | //
19 | // Version information for an assembly consists of the following four values:
20 | //
21 | // Major Version
22 | // Minor Version
23 | // Build Number
24 | // Revision
25 | //
26 | // You can specify all the values or you can default the Revision and Build Numbers
27 | // by using the '*' as shown below:
28 |
29 | [assembly: AssemblyVersion("1.0.*")]
30 |
31 | //
32 | // In order to sign your assembly you must specify a key to use. Refer to the
33 | // Microsoft .NET Framework documentation for more information on assembly signing.
34 | //
35 | // Use the attributes below to control which key is used for signing.
36 | //
37 | // Notes:
38 | // (*) If no key is specified, the assembly is not signed.
39 | // (*) KeyName refers to a key that has been installed in the Crypto Service
40 | // Provider (CSP) on your machine. KeyFile refers to a file which contains
41 | // a key.
42 | // (*) If the KeyFile and the KeyName values are both specified, the
43 | // following processing occurs:
44 | // (1) If the KeyName can be found in the CSP, that key is used.
45 | // (2) If the KeyName does not exist and the KeyFile does exist, the key
46 | // in the KeyFile is installed into the CSP and used.
47 | // (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
48 | // When specifying the KeyFile, the location of the KeyFile should be
49 | // relative to the project output directory which is
50 | // %Project Directory%\obj\. For example, if your KeyFile is
51 | // located in the project directory, you would specify the AssemblyKeyFile
52 | // attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
53 | // (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
54 | // documentation for more information on this.
55 | //
56 | [assembly: AssemblyDelaySign(false)]
57 | [assembly: AssemblyKeyFile("")]
58 | [assembly: AssemblyKeyName("")]
59 |
--------------------------------------------------------------------------------
/ToolsExample/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------