Revision | 87cb69e06e3d7d461a93b53a55bb65aefd27b85b (tree) |
---|---|
Time | 2015-07-09 11:49:53 |
Author | komutan <t_komuta@nift...> |
Commiter | komutan |
微修正
@@ -10,21 +10,16 @@ namespace NMeCab.Core | ||
10 | 10 | private class Node |
11 | 11 | { |
12 | 12 | public T Value { get; private set; } |
13 | - | |
14 | - public int ChiledsCount { get; private set; } | |
15 | - | |
13 | + public int ChildsCount { get; private set; } | |
16 | 14 | public Node FirstChild { get; private set; } |
17 | - | |
18 | 15 | public Node LastChild { get; private set; } |
19 | - | |
20 | 16 | public Node Prev { get; private set; } |
21 | - | |
22 | 17 | public Node Next { get; private set; } |
23 | 18 | |
24 | 19 | public void AddFirstChild(Node first) |
25 | 20 | { |
26 | - this.ChiledsCount++; | |
27 | - if (this.ChiledsCount == 1) | |
21 | + this.ChildsCount++; | |
22 | + if (this.ChildsCount == 1) | |
28 | 23 | { |
29 | 24 | this.LastChild = first; |
30 | 25 | } |
@@ -39,8 +34,8 @@ namespace NMeCab.Core | ||
39 | 34 | |
40 | 35 | public void AddLastChild(Node last) |
41 | 36 | { |
42 | - this.ChiledsCount++; | |
43 | - if (this.ChiledsCount == 1) | |
37 | + this.ChildsCount++; | |
38 | + if (this.ChildsCount == 1) | |
44 | 39 | { |
45 | 40 | this.FirstChild = last; |
46 | 41 | } |
@@ -55,8 +50,8 @@ namespace NMeCab.Core | ||
55 | 50 | |
56 | 51 | public Node PollFirstChild() |
57 | 52 | { |
58 | - this.ChiledsCount--; | |
59 | - if (this.ChiledsCount == 0) | |
53 | + this.ChildsCount--; | |
54 | + if (this.ChildsCount == 0) | |
60 | 55 | { |
61 | 56 | this.LastChild.Prev = null; |
62 | 57 | this.LastChild = null; |
@@ -128,9 +123,9 @@ namespace NMeCab.Core | ||
128 | 123 | |
129 | 124 | private Node Unify(Node node) |
130 | 125 | { |
131 | - if (node == null || node.ChiledsCount == 0) return null; | |
126 | + if (node == null || node.ChildsCount == 0) return null; | |
132 | 127 | |
133 | - Node[] tmp = new Node[node.ChiledsCount / 2]; //擬似的Stack | |
128 | + Node[] tmp = new Node[node.ChildsCount / 2]; //必要な要素数が明らかなのでStackではなく配列 | |
134 | 129 | |
135 | 130 | for (int i = 0; i < tmp.Length; i++) |
136 | 131 | { |
@@ -140,12 +135,12 @@ namespace NMeCab.Core | ||
140 | 135 | } |
141 | 136 | |
142 | 137 | Node z; |
143 | - if (node.ChiledsCount == 1) | |
138 | + if (node.ChildsCount == 1) //子要素数が奇数の場合、まだ1つ残っている子要素をここで処理 | |
144 | 139 | z = node.PollFirstChild(); |
145 | 140 | else |
146 | 141 | z = null; |
147 | 142 | |
148 | - for (int i = tmp.Length - 1; i >= 0; i--) | |
143 | + for (int i = tmp.Length - 1; i >= 0; i--) //逆順ループで配列をStackのように振る舞わせる | |
149 | 144 | { |
150 | 145 | z = this.Merge(tmp[i], z); |
151 | 146 | } |
@@ -1,4 +1,4 @@ | ||
1 | -<?xml version="1.0" encoding="utf-8" ?> | |
1 | +<?xml version="1.0" encoding="utf-8" ?> | |
2 | 2 | <configuration> |
3 | 3 | <configSections> |
4 | 4 | <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" > |
@@ -1,156 +0,0 @@ | ||
1 | -<?xml version="1.0" encoding="utf-8"?> | |
2 | -<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
3 | - <PropertyGroup> | |
4 | - <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |
5 | - <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | |
6 | - <ProductVersion>8.0.30703</ProductVersion> | |
7 | - <SchemaVersion>2.0</SchemaVersion> | |
8 | - <ProjectGuid>{B5C3DDEA-F7CE-4A9D-8B28-5FC1B582A4EB}</ProjectGuid> | |
9 | - <OutputType>Library</OutputType> | |
10 | - <AppDesignerFolder>Properties</AppDesignerFolder> | |
11 | - <RootNamespace>NMeCab</RootNamespace> | |
12 | - <AssemblyName>LibNMeCab</AssemblyName> | |
13 | - <TargetFrameworkVersion>v4.0</TargetFrameworkVersion> | |
14 | - <FileAlignment>512</FileAlignment> | |
15 | - </PropertyGroup> | |
16 | - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | |
17 | - <DebugSymbols>true</DebugSymbols> | |
18 | - <DebugType>full</DebugType> | |
19 | - <Optimize>false</Optimize> | |
20 | - <OutputPath>bin\Debug\</OutputPath> | |
21 | - <DefineConstants>DEBUG;MMF MMF_DIC MMF_MTX EXT</DefineConstants> | |
22 | - <ErrorReport>prompt</ErrorReport> | |
23 | - <WarningLevel>4</WarningLevel> | |
24 | - <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | |
25 | - </PropertyGroup> | |
26 | - <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | |
27 | - <DebugType>pdbonly</DebugType> | |
28 | - <Optimize>true</Optimize> | |
29 | - <OutputPath>bin\Release\</OutputPath> | |
30 | - <DefineConstants>MMF MMF_DIC MMF_MTX</DefineConstants> | |
31 | - <ErrorReport>prompt</ErrorReport> | |
32 | - <WarningLevel>4</WarningLevel> | |
33 | - <AllowUnsafeBlocks>true</AllowUnsafeBlocks> | |
34 | - </PropertyGroup> | |
35 | - <ItemGroup> | |
36 | - <Reference Include="System" /> | |
37 | - </ItemGroup> | |
38 | - <ItemGroup> | |
39 | - <Compile Include="..\LibNMeCab\Core\BitUtils.cs"> | |
40 | - <Link>Core\BitUtils.cs</Link> | |
41 | - </Compile> | |
42 | - <Compile Include="..\LibNMeCab\Core\CharInfo.cs"> | |
43 | - <Link>Core\CharInfo.cs</Link> | |
44 | - </Compile> | |
45 | - <Compile Include="..\LibNMeCab\Core\CharProperty.cs"> | |
46 | - <Link>Core\CharProperty.cs</Link> | |
47 | - </Compile> | |
48 | - <Compile Include="..\LibNMeCab\Core\Connector.cs"> | |
49 | - <Link>Core\Connector.cs</Link> | |
50 | - </Compile> | |
51 | - <Compile Include="..\LibNMeCab\Core\DoubleArray.cs"> | |
52 | - <Link>Core\DoubleArray.cs</Link> | |
53 | - </Compile> | |
54 | - <Compile Include="..\LibNMeCab\Core\IniParser.cs"> | |
55 | - <Link>Core\IniParser.cs</Link> | |
56 | - </Compile> | |
57 | - <Compile Include="..\LibNMeCab\Core\MeCabDictionary.cs"> | |
58 | - <Link>Core\MeCabDictionary.cs</Link> | |
59 | - </Compile> | |
60 | - <Compile Include="..\LibNMeCab\Core\MeCabPath.cs"> | |
61 | - <Link>Core\MeCabPath.cs</Link> | |
62 | - </Compile> | |
63 | - <Compile Include="..\LibNMeCab\Core\NBestGenerator.cs"> | |
64 | - <Link>Core\NBestGenerator.cs</Link> | |
65 | - </Compile> | |
66 | - <Compile Include="..\LibNMeCab\Core\PriorityQueue.cs"> | |
67 | - <Link>Core\PriorityQueue.cs</Link> | |
68 | - </Compile> | |
69 | - <Compile Include="..\LibNMeCab\Core\StrUtils.cs"> | |
70 | - <Link>Core\StrUtils.cs</Link> | |
71 | - </Compile> | |
72 | - <Compile Include="..\LibNMeCab\Core\Token.cs"> | |
73 | - <Link>Core\Token.cs</Link> | |
74 | - </Compile> | |
75 | - <Compile Include="..\LibNMeCab\Core\Tokenizer.cs"> | |
76 | - <Link>Core\Tokenizer.cs</Link> | |
77 | - </Compile> | |
78 | - <Compile Include="..\LibNMeCab\Core\Utils.cs"> | |
79 | - <Link>Core\Utils.cs</Link> | |
80 | - </Compile> | |
81 | - <Compile Include="..\LibNMeCab\Core\Viterbi.cs"> | |
82 | - <Link>Core\Viterbi.cs</Link> | |
83 | - </Compile> | |
84 | - <Compile Include="..\LibNMeCab\Core\Writer.cs"> | |
85 | - <Link>Core\Writer.cs</Link> | |
86 | - </Compile> | |
87 | - <Compile Include="..\LibNMeCab\Extension\FeatureExtension.cs"> | |
88 | - <Link>Extension\FeatureExtension.cs</Link> | |
89 | - </Compile> | |
90 | - <Compile Include="..\LibNMeCab\Extension\IpaDic\IpaDicFeatureExtension.cs"> | |
91 | - <Link>Extension\IpaDic\IpaDicFeatureExtension.cs</Link> | |
92 | - </Compile> | |
93 | - <Compile Include="..\LibNMeCab\Extension\UniDic\UniDicFeatureExtension.cs"> | |
94 | - <Link>Extension\UniDic\UniDicFeatureExtension.cs</Link> | |
95 | - </Compile> | |
96 | - <Compile Include="..\LibNMeCab\MeCabDictionaryType.cs"> | |
97 | - <Link>MeCabDictionaryType.cs</Link> | |
98 | - </Compile> | |
99 | - <Compile Include="..\LibNMeCab\MeCabException.cs"> | |
100 | - <Link>MeCabException.cs</Link> | |
101 | - </Compile> | |
102 | - <Compile Include="..\LibNMeCab\MeCabFileFormatException.cs"> | |
103 | - <Link>MeCabFileFormatException.cs</Link> | |
104 | - </Compile> | |
105 | - <Compile Include="..\LibNMeCab\MeCabInvalidFileException.cs"> | |
106 | - <Link>MeCabInvalidFileException.cs</Link> | |
107 | - </Compile> | |
108 | - <Compile Include="..\LibNMeCab\MeCabLatticeLevel.cs"> | |
109 | - <Link>MeCabLatticeLevel.cs</Link> | |
110 | - </Compile> | |
111 | - <Compile Include="..\LibNMeCab\MeCabNode.cs"> | |
112 | - <Link>MeCabNode.cs</Link> | |
113 | - </Compile> | |
114 | - <Compile Include="..\LibNMeCab\MeCabNodeStat.cs"> | |
115 | - <Link>MeCabNodeStat.cs</Link> | |
116 | - </Compile> | |
117 | - <Compile Include="..\LibNMeCab\MeCabParam.cs"> | |
118 | - <Link>MeCabParam.cs</Link> | |
119 | - </Compile> | |
120 | - <Compile Include="..\LibNMeCab\MeCabTagger.cs"> | |
121 | - <Link>MeCabTagger.cs</Link> | |
122 | - </Compile> | |
123 | - <Compile Include="..\LibNMeCab\Properties\Settings.Designer.cs"> | |
124 | - <Link>Properties\Settings.Designer.cs</Link> | |
125 | - <AutoGen>True</AutoGen> | |
126 | - <DesignTimeSharedInput>True</DesignTimeSharedInput> | |
127 | - </Compile> | |
128 | - <Compile Include="..\LibNMeCab\Properties\SharedAssemblyInfo.cs"> | |
129 | - <Link>Properties\SharedAssemblyInfo.cs</Link> | |
130 | - </Compile> | |
131 | - <Compile Include="..\LibNMeCab\Settings.cs"> | |
132 | - <Link>Settings.cs</Link> | |
133 | - </Compile> | |
134 | - <Compile Include="Properties\AssemblyInfo.cs" /> | |
135 | - </ItemGroup> | |
136 | - <ItemGroup> | |
137 | - <None Include="..\LibNMeCab\Properties\Settings.settings"> | |
138 | - <Link>Properties\Settings.settings</Link> | |
139 | - <Generator>SettingsSingleFileGenerator</Generator> | |
140 | - <LastGenOutput>Settings.Designer.cs</LastGenOutput> | |
141 | - </None> | |
142 | - <None Include="app.config" /> | |
143 | - </ItemGroup> | |
144 | - <ItemGroup /> | |
145 | - <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | |
146 | - <PropertyGroup> | |
147 | - <PostBuildEvent>copy /y "$(TargetPath)" "$(SolutionDir)..\bin\MMF\"</PostBuildEvent> | |
148 | - </PropertyGroup> | |
149 | - <!-- To modify your build process, add your task inside one of the targets below and uncomment it. | |
150 | - Other similar extension points exist, see Microsoft.Common.targets. | |
151 | - <Target Name="BeforeBuild"> | |
152 | - </Target> | |
153 | - <Target Name="AfterBuild"> | |
154 | - </Target> | |
155 | - --> | |
156 | -</Project> | |
\ No newline at end of file |
@@ -1,36 +0,0 @@ | ||
1 | -using System.Reflection; | |
2 | -using System.Runtime.CompilerServices; | |
3 | -using System.Runtime.InteropServices; | |
4 | - | |
5 | -// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。 | |
6 | -// アセンブリに関連付けられている情報を変更するには、 | |
7 | -// これらの属性値を変更してください。 | |
8 | -[assembly: AssemblyTitle("LibNMeCab")] | |
9 | -[assembly: AssemblyDescription("")] | |
10 | -//[assembly: AssemblyConfiguration("")] | |
11 | -//[assembly: AssemblyCompany("")] | |
12 | -//[assembly: AssemblyProduct("")] | |
13 | -//[assembly: AssemblyCopyright("")] | |
14 | -//[assembly: AssemblyTrademark("")] | |
15 | -//[assembly: AssemblyCulture("")] | |
16 | - | |
17 | -// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから | |
18 | -// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、 | |
19 | -// その型の ComVisible 属性を true に設定してください。 | |
20 | -[assembly: ComVisible(false)] | |
21 | - | |
22 | -// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です | |
23 | -[assembly: Guid("e16f6fba-3cf5-41fa-9002-5b0f91f87e05")] | |
24 | - | |
25 | -// アセンブリのバージョン情報は、以下の 4 つの値で構成されています: | |
26 | -// | |
27 | -// Major Version | |
28 | -// Minor Version | |
29 | -// Build Number | |
30 | -// Revision | |
31 | -// | |
32 | -// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を | |
33 | -// 既定値にすることができます: | |
34 | -// [assembly: AssemblyVersion("1.0.*")] | |
35 | -//[assembly: AssemblyVersion("1.0.0.0")] | |
36 | -//[assembly: AssemblyFileVersion("1.0.0.0")] |
@@ -46,10 +46,10 @@ namespace LibNMeCabTest | ||
46 | 46 | var collection = new List<Element>(); |
47 | 47 | var count = 0; |
48 | 48 | |
49 | - for (int i = 0; i < 2; i++) | |
49 | + for (int i = 0; i < 5; i++) | |
50 | 50 | { |
51 | 51 | //追加 優先度昇順 |
52 | - for (int j = 0; j < 3; j++) | |
52 | + for (int j = 0; j < 5; j++) | |
53 | 53 | { |
54 | 54 | var item = new Element { Priority = j, Order = count }; |
55 | 55 | queue.Push(item); |
@@ -82,10 +82,10 @@ namespace LibNMeCabTest | ||
82 | 82 | var collection = new List<Element>(); |
83 | 83 | var count = 0; |
84 | 84 | |
85 | - for (int i = 0; i < 2; i++) | |
85 | + for (int i = 0; i < 5; i++) | |
86 | 86 | { |
87 | 87 | //追加 優先度降順 |
88 | - for (int j = 3; j >= 0; j--) | |
88 | + for (int j = 5; j >= 0; j--) | |
89 | 89 | { |
90 | 90 | var item = new Element { Priority = j, Order = count }; |
91 | 91 | queue.Push(item); |
@@ -34,10 +34,6 @@ | ||
34 | 34 | <WarningLevel>4</WarningLevel> |
35 | 35 | </PropertyGroup> |
36 | 36 | <ItemGroup> |
37 | - <Reference Include="LibNMeCab, Version=0.0.7.0, Culture=neutral, processorArchitecture=MSIL"> | |
38 | - <SpecificVersion>False</SpecificVersion> | |
39 | - <HintPath>..\LibNMeCab40MMF\bin\Release\LibNMeCab.dll</HintPath> | |
40 | - </Reference> | |
41 | 37 | <Reference Include="System" /> |
42 | 38 | </ItemGroup> |
43 | 39 | <ItemGroup> |
@@ -69,6 +65,12 @@ | ||
69 | 65 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> |
70 | 66 | </Content> |
71 | 67 | </ItemGroup> |
68 | + <ItemGroup> | |
69 | + <ProjectReference Include="..\LibNMeCab40MMF\LibNMeCab40MMF.csproj"> | |
70 | + <Project>{86711194-4c2b-4853-830f-07c57f035283}</Project> | |
71 | + <Name>LibNMeCab40MMF</Name> | |
72 | + </ProjectReference> | |
73 | + </ItemGroup> | |
72 | 74 | <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> |
73 | 75 | <!-- To modify your build process, add your task inside one of the targets below and uncomment it. |
74 | 76 | Other similar extension points exist, see Microsoft.Common.targets. |