OSDN Git Service

微修正
authorkomutan <t_komuta@nifty.com>
Thu, 9 Jul 2015 02:49:53 +0000 (11:49 +0900)
committerkomutan <t_komuta@nifty.com>
Thu, 9 Jul 2015 02:49:53 +0000 (11:49 +0900)
src/LibNMeCab/Core/PriorityQueue.cs
src/LibNMeCab40MMF/bin/Debug/LibNMeCab.dll.config [moved from src/LibNMeCabMMF/app.config with 93% similarity]
src/LibNMeCabMMF/LibNMeCabMMF.csproj [deleted file]
src/LibNMeCabMMF/Properties/AssemblyInfo.cs [deleted file]
src/LibNMeCabTest/PriorityQueueTest.cs
src/PerformanceTestMMF/PerformanceTestMMF.csproj

index 75f73c8..2449c8c 100644 (file)
@@ -10,21 +10,16 @@ namespace NMeCab.Core
         private class Node
         {
             public T Value { get; private set; }
-
-            public int ChiledsCount { get; private set; }
-
+            public int ChildsCount { get; private set; }
             public Node FirstChild { get; private set; }
-
             public Node LastChild { get; private set; }
-
             public Node Prev { get; private set; }
-
             public Node Next { get; private set; }
 
             public void AddFirstChild(Node first)
             {
-                this.ChiledsCount++;
-                if (this.ChiledsCount == 1)
+                this.ChildsCount++;
+                if (this.ChildsCount == 1)
                 {
                     this.LastChild = first;
                 }
@@ -39,8 +34,8 @@ namespace NMeCab.Core
 
             public void AddLastChild(Node last)
             {
-                this.ChiledsCount++;
-                if (this.ChiledsCount == 1)
+                this.ChildsCount++;
+                if (this.ChildsCount == 1)
                 {
                     this.FirstChild = last;
                 }
@@ -55,8 +50,8 @@ namespace NMeCab.Core
 
             public Node PollFirstChild()
             {
-                this.ChiledsCount--;
-                if (this.ChiledsCount == 0)
+                this.ChildsCount--;
+                if (this.ChildsCount == 0)
                 {
                     this.LastChild.Prev = null;
                     this.LastChild = null;
@@ -128,9 +123,9 @@ namespace NMeCab.Core
 
         private Node Unify(Node node)
         {
-            if (node == null || node.ChiledsCount == 0) return null;
+            if (node == null || node.ChildsCount == 0) return null;
 
-            Node[] tmp = new Node[node.ChiledsCount / 2]; //擬似的Stack
+            Node[] tmp = new Node[node.ChildsCount / 2]; //必要な要素数が明らかなのでStackではなく配列
 
             for (int i = 0; i < tmp.Length; i++)
             {
@@ -140,12 +135,12 @@ namespace NMeCab.Core
             }
 
             Node z;
-            if (node.ChiledsCount == 1)
+            if (node.ChildsCount == 1) //子要素数が奇数の場合、まだ1つ残っている子要素をここで処理
                 z = node.PollFirstChild();
             else
                 z = null;
 
-            for (int i = tmp.Length - 1; i >= 0; i--)
+            for (int i = tmp.Length - 1; i >= 0; i--) //逆順ループで配列をStackのように振る舞わせる
             {
                 z = this.Merge(tmp[i], z);
             }
similarity index 93%
rename from src/LibNMeCabMMF/app.config
rename to src/LibNMeCab40MMF/bin/Debug/LibNMeCab.dll.config
index 2f00818..7d9aef3 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" ?>
+<?xml version="1.0" encoding="utf-8" ?>
 <configuration>
   <configSections>
     <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
diff --git a/src/LibNMeCabMMF/LibNMeCabMMF.csproj b/src/LibNMeCabMMF/LibNMeCabMMF.csproj
deleted file mode 100644 (file)
index f9b9b23..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup>
-    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
-    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProductVersion>8.0.30703</ProductVersion>
-    <SchemaVersion>2.0</SchemaVersion>
-    <ProjectGuid>{B5C3DDEA-F7CE-4A9D-8B28-5FC1B582A4EB}</ProjectGuid>
-    <OutputType>Library</OutputType>
-    <AppDesignerFolder>Properties</AppDesignerFolder>
-    <RootNamespace>NMeCab</RootNamespace>
-    <AssemblyName>LibNMeCab</AssemblyName>
-    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
-    <FileAlignment>512</FileAlignment>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
-    <DebugSymbols>true</DebugSymbols>
-    <DebugType>full</DebugType>
-    <Optimize>false</Optimize>
-    <OutputPath>bin\Debug\</OutputPath>
-    <DefineConstants>DEBUG;MMF MMF_DIC MMF_MTX EXT</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
-    <DebugType>pdbonly</DebugType>
-    <Optimize>true</Optimize>
-    <OutputPath>bin\Release\</OutputPath>
-    <DefineConstants>MMF MMF_DIC MMF_MTX</DefineConstants>
-    <ErrorReport>prompt</ErrorReport>
-    <WarningLevel>4</WarningLevel>
-    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-  </PropertyGroup>
-  <ItemGroup>
-    <Reference Include="System" />
-  </ItemGroup>
-  <ItemGroup>
-    <Compile Include="..\LibNMeCab\Core\BitUtils.cs">
-      <Link>Core\BitUtils.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\CharInfo.cs">
-      <Link>Core\CharInfo.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\CharProperty.cs">
-      <Link>Core\CharProperty.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\Connector.cs">
-      <Link>Core\Connector.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\DoubleArray.cs">
-      <Link>Core\DoubleArray.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\IniParser.cs">
-      <Link>Core\IniParser.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\MeCabDictionary.cs">
-      <Link>Core\MeCabDictionary.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\MeCabPath.cs">
-      <Link>Core\MeCabPath.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\NBestGenerator.cs">
-      <Link>Core\NBestGenerator.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\PriorityQueue.cs">
-      <Link>Core\PriorityQueue.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\StrUtils.cs">
-      <Link>Core\StrUtils.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\Token.cs">
-      <Link>Core\Token.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\Tokenizer.cs">
-      <Link>Core\Tokenizer.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\Utils.cs">
-      <Link>Core\Utils.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\Viterbi.cs">
-      <Link>Core\Viterbi.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Core\Writer.cs">
-      <Link>Core\Writer.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Extension\FeatureExtension.cs">
-      <Link>Extension\FeatureExtension.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Extension\IpaDic\IpaDicFeatureExtension.cs">
-      <Link>Extension\IpaDic\IpaDicFeatureExtension.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Extension\UniDic\UniDicFeatureExtension.cs">
-      <Link>Extension\UniDic\UniDicFeatureExtension.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\MeCabDictionaryType.cs">
-      <Link>MeCabDictionaryType.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\MeCabException.cs">
-      <Link>MeCabException.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\MeCabFileFormatException.cs">
-      <Link>MeCabFileFormatException.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\MeCabInvalidFileException.cs">
-      <Link>MeCabInvalidFileException.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\MeCabLatticeLevel.cs">
-      <Link>MeCabLatticeLevel.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\MeCabNode.cs">
-      <Link>MeCabNode.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\MeCabNodeStat.cs">
-      <Link>MeCabNodeStat.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\MeCabParam.cs">
-      <Link>MeCabParam.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\MeCabTagger.cs">
-      <Link>MeCabTagger.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Properties\Settings.Designer.cs">
-      <Link>Properties\Settings.Designer.cs</Link>
-      <AutoGen>True</AutoGen>
-      <DesignTimeSharedInput>True</DesignTimeSharedInput>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Properties\SharedAssemblyInfo.cs">
-      <Link>Properties\SharedAssemblyInfo.cs</Link>
-    </Compile>
-    <Compile Include="..\LibNMeCab\Settings.cs">
-      <Link>Settings.cs</Link>
-    </Compile>
-    <Compile Include="Properties\AssemblyInfo.cs" />
-  </ItemGroup>
-  <ItemGroup>
-    <None Include="..\LibNMeCab\Properties\Settings.settings">
-      <Link>Properties\Settings.settings</Link>
-      <Generator>SettingsSingleFileGenerator</Generator>
-      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
-    </None>
-    <None Include="app.config" />
-  </ItemGroup>
-  <ItemGroup />
-  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <PropertyGroup>
-    <PostBuildEvent>copy /y "$(TargetPath)" "$(SolutionDir)..\bin\MMF\"</PostBuildEvent>
-  </PropertyGroup>
-  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
-       Other similar extension points exist, see Microsoft.Common.targets.
-  <Target Name="BeforeBuild">
-  </Target>
-  <Target Name="AfterBuild">
-  </Target>
-  -->
-</Project>
\ No newline at end of file
diff --git a/src/LibNMeCabMMF/Properties/AssemblyInfo.cs b/src/LibNMeCabMMF/Properties/AssemblyInfo.cs
deleted file mode 100644 (file)
index c4fbd17..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-using System.Reflection;\r
-using System.Runtime.CompilerServices;\r
-using System.Runtime.InteropServices;\r
-\r
-// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。\r
-// アセンブリに関連付けられている情報を変更するには、\r
-// これらの属性値を変更してください。\r
-[assembly: AssemblyTitle("LibNMeCab")]\r
-[assembly: AssemblyDescription("")]\r
-//[assembly: AssemblyConfiguration("")]\r
-//[assembly: AssemblyCompany("")]\r
-//[assembly: AssemblyProduct("")]\r
-//[assembly: AssemblyCopyright("")]\r
-//[assembly: AssemblyTrademark("")]\r
-//[assembly: AssemblyCulture("")]\r
-\r
-// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから \r
-// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、\r
-// その型の ComVisible 属性を true に設定してください。\r
-[assembly: ComVisible(false)]\r
-\r
-// 次の GUID は、このプロジェクトが COM に公開される場合の、typelib の ID です\r
-[assembly: Guid("e16f6fba-3cf5-41fa-9002-5b0f91f87e05")]\r
-\r
-// アセンブリのバージョン情報は、以下の 4 つの値で構成されています:\r
-//\r
-//      Major Version\r
-//      Minor Version \r
-//      Build Number\r
-//      Revision\r
-//\r
-// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を \r
-// 既定値にすることができます:\r
-// [assembly: AssemblyVersion("1.0.*")]\r
-//[assembly: AssemblyVersion("1.0.0.0")]\r
-//[assembly: AssemblyFileVersion("1.0.0.0")]\r
index aa3a6c9..c21acad 100644 (file)
@@ -46,10 +46,10 @@ namespace LibNMeCabTest
             var collection = new List<Element>();
             var count = 0;
 
-            for (int i = 0; i < 2; i++)
+            for (int i = 0; i < 5; i++)
             {
                 //追加 優先度昇順
-                for (int j = 0; j < 3; j++)
+                for (int j = 0; j < 5; j++)
                 {
                     var item = new Element { Priority = j, Order = count };
                     queue.Push(item);
@@ -82,10 +82,10 @@ namespace LibNMeCabTest
             var collection = new List<Element>();
             var count = 0;
 
-            for (int i = 0; i < 2; i++)
+            for (int i = 0; i < 5; i++)
             {
                 //追加 優先度降順
-                for (int j = 3; j >= 0; j--)
+                for (int j = 5; j >= 0; j--)
                 {
                     var item = new Element { Priority = j, Order = count };
                     queue.Push(item);
index 73bb934..947239d 100644 (file)
     <WarningLevel>4</WarningLevel>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="LibNMeCab, Version=0.0.7.0, Culture=neutral, processorArchitecture=MSIL">
-      <SpecificVersion>False</SpecificVersion>
-      <HintPath>..\LibNMeCab40MMF\bin\Release\LibNMeCab.dll</HintPath>
-    </Reference>
     <Reference Include="System" />
   </ItemGroup>
   <ItemGroup>
       <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
     </Content>
   </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\LibNMeCab40MMF\LibNMeCab40MMF.csproj">
+      <Project>{86711194-4c2b-4853-830f-07c57f035283}</Project>
+      <Name>LibNMeCab40MMF</Name>
+    </ProjectReference>
+  </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
   <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
        Other similar extension points exist, see Microsoft.Common.targets.