• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revision72bd52a5d441558ec25a93ae3f7369933e99de81 (tree)
Time2017-02-20 17:13:31
AuthorTakuya Sakurai <azyobuzin@user...>
CommiterTakuya Sakurai

Log Message

よみがな生成器を追加

Change Summary

Incremental Difference

--- a/src/LibNMeCab46Stream/LibNMeCab46Stream.csproj
+++ b/src/LibNMeCab46Stream/LibNMeCab46Stream.csproj
@@ -21,6 +21,8 @@
2121 <ErrorReport>prompt</ErrorReport>
2222 <WarningLevel>4</WarningLevel>
2323 <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
24+ <DocumentationFile>bin\Debug\LibNMeCab.XML</DocumentationFile>
25+ <NoWarn>1591;1573</NoWarn>
2426 </PropertyGroup>
2527 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2628 <DebugType>pdbonly</DebugType>
@@ -30,6 +32,8 @@
3032 <ErrorReport>prompt</ErrorReport>
3133 <WarningLevel>4</WarningLevel>
3234 <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
35+ <DocumentationFile>bin\Release\LibNMeCab.XML</DocumentationFile>
36+ <NoWarn>1591;1573</NoWarn>
3337 </PropertyGroup>
3438 <ItemGroup>
3539 <Reference Include="System" />
--- /dev/null
+++ b/src/MeCabWrapper/MeCabFarm.cs
@@ -0,0 +1,32 @@
1+using System.IO;
2+using NMeCab;
3+
4+namespace MeCabWrapper
5+{
6+ public class MeCabFarm
7+ {
8+ // MeCabTagger はスレッドセーフ
9+ // https://ja.osdn.net/projects/nmecab/wiki/FrontPage
10+ public static MeCabTagger DefaultTagger { get; }
11+
12+ private static Stream OpenDicResource(string name)
13+ {
14+ return typeof(MeCabFarm).Assembly
15+ .GetManifestResourceStream(typeof(MeCabFarm), "dic.ipadic." + name);
16+ }
17+
18+ static MeCabFarm()
19+ {
20+ var param = new MeCabParam()
21+ {
22+ UnkDic = () => OpenDicResource("unk.dic"),
23+ SysDic = () => OpenDicResource("sys.dic"),
24+ CharProperty = () => OpenDicResource("char.bin"),
25+ Matrix = () => OpenDicResource("matrix.bin"),
26+ Rc = () => OpenDicResource("dicrc"),
27+ };
28+
29+ DefaultTagger = MeCabTagger.Create(param);
30+ }
31+ }
32+}
--- /dev/null
+++ b/src/MeCabWrapper/MeCabWrapper.csproj
@@ -0,0 +1,73 @@
1+<?xml version="1.0" encoding="utf-8"?>
2+<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+ <PropertyGroup>
5+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+ <ProjectGuid>{DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}</ProjectGuid>
8+ <OutputType>Library</OutputType>
9+ <AppDesignerFolder>Properties</AppDesignerFolder>
10+ <RootNamespace>MeCabWrapper</RootNamespace>
11+ <AssemblyName>MeCabWrapper</AssemblyName>
12+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
13+ <FileAlignment>512</FileAlignment>
14+ </PropertyGroup>
15+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+ <DebugSymbols>true</DebugSymbols>
17+ <DebugType>full</DebugType>
18+ <Optimize>false</Optimize>
19+ <OutputPath>bin\Debug\</OutputPath>
20+ <DefineConstants>DEBUG;TRACE</DefineConstants>
21+ <ErrorReport>prompt</ErrorReport>
22+ <WarningLevel>4</WarningLevel>
23+ </PropertyGroup>
24+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25+ <DebugType>pdbonly</DebugType>
26+ <Optimize>true</Optimize>
27+ <OutputPath>bin\Release\</OutputPath>
28+ <DefineConstants>TRACE</DefineConstants>
29+ <ErrorReport>prompt</ErrorReport>
30+ <WarningLevel>4</WarningLevel>
31+ </PropertyGroup>
32+ <ItemGroup>
33+ <Reference Include="System" />
34+ <Reference Include="System.Core" />
35+ <Reference Include="Microsoft.CSharp" />
36+ </ItemGroup>
37+ <ItemGroup>
38+ <Compile Include="MeCabFarm.cs" />
39+ <Compile Include="Properties\AssemblyInfo.cs" />
40+ <Compile Include="YomiGenerator.cs" />
41+ </ItemGroup>
42+ <ItemGroup>
43+ <EmbeddedResource Include="..\..\dic\ipadic\char.bin">
44+ <Link>dic\ipadic\char.bin</Link>
45+ </EmbeddedResource>
46+ <EmbeddedResource Include="..\..\dic\ipadic\dicrc">
47+ <Link>dic\ipadic\dicrc</Link>
48+ </EmbeddedResource>
49+ <EmbeddedResource Include="..\..\dic\ipadic\matrix.bin">
50+ <Link>dic\ipadic\matrix.bin</Link>
51+ </EmbeddedResource>
52+ <EmbeddedResource Include="..\..\dic\ipadic\sys.dic">
53+ <Link>dic\ipadic\sys.dic</Link>
54+ </EmbeddedResource>
55+ <EmbeddedResource Include="..\..\dic\ipadic\unk.dic">
56+ <Link>dic\ipadic\unk.dic</Link>
57+ </EmbeddedResource>
58+ </ItemGroup>
59+ <ItemGroup>
60+ <ProjectReference Include="..\LibNMeCab46Stream\LibNMeCab46Stream.csproj">
61+ <Project>{6831370d-007e-404d-bfe8-777d41514a8d}</Project>
62+ <Name>LibNMeCab46Stream</Name>
63+ </ProjectReference>
64+ </ItemGroup>
65+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
66+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
67+ Other similar extension points exist, see Microsoft.Common.targets.
68+ <Target Name="BeforeBuild">
69+ </Target>
70+ <Target Name="AfterBuild">
71+ </Target>
72+ -->
73+</Project>
\ No newline at end of file
--- /dev/null
+++ b/src/MeCabWrapper/MeCabWrapper.nuspec
@@ -0,0 +1,15 @@
1+<?xml version="1.0"?>
2+<package>
3+ <metadata>
4+ <id>MeCabWrapper</id>
5+ <version>$version$</version>
6+ <title>MeCabWrapper</title>
7+ <authors>azyobuzin</authors>
8+ <projectUrl>https://osdn.net/users/azyobuzin/pf/NMeCabRepo2/wiki/FrontPage</projectUrl>
9+ <description>NMeCabと辞書のセット with YomiGenerator</description>
10+ </metadata>
11+ <files>
12+ <file src="bin\$configuration$\LibNMeCab.dll" target="lib\net461" />
13+ <file src="bin\$configuration$\LibNMeCab.xml" target="lib\net461" />
14+ </files>
15+</package>
\ No newline at end of file
--- /dev/null
+++ b/src/MeCabWrapper/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
1+using System.Reflection;
2+using System.Runtime.CompilerServices;
3+using System.Runtime.InteropServices;
4+
5+// アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6+// アセンブリに関連付けられている情報を変更するには、
7+// これらの属性値を変更してください。
8+[assembly: AssemblyTitle("MeCabWrapper")]
9+[assembly: AssemblyDescription("")]
10+[assembly: AssemblyConfiguration("")]
11+[assembly: AssemblyCompany("")]
12+[assembly: AssemblyProduct("MeCabWrapper")]
13+[assembly: AssemblyCopyright("Copyright © 2017")]
14+[assembly: AssemblyTrademark("")]
15+[assembly: AssemblyCulture("")]
16+
17+// ComVisible を false に設定すると、その型はこのアセンブリ内で COM コンポーネントから
18+// 参照不可能になります。COM からこのアセンブリ内の型にアクセスする場合は、
19+// その型の ComVisible 属性を true に設定してください。
20+[assembly: ComVisible(false)]
21+
22+// このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
23+[assembly: Guid("de32da99-6ff2-4a3f-a6de-88f547aa6bb0")]
24+
25+// アセンブリのバージョン情報は次の 4 つの値で構成されています:
26+//
27+// メジャー バージョン
28+// マイナー バージョン
29+// ビルド番号
30+// Revision
31+//
32+// すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を
33+// 既定値にすることができます:
34+// [assembly: AssemblyVersion("1.0.*")]
35+[assembly: AssemblyVersion("1.0.0.0")]
36+[assembly: AssemblyFileVersion("1.0.0.0")]
--- /dev/null
+++ b/src/MeCabWrapper/YomiGenerator.cs
@@ -0,0 +1,21 @@
1+using System.Text;
2+using NMeCab;
3+using NMeCab.Extension.IpaDic;
4+
5+namespace MeCabWrapper
6+{
7+ public static class YomiGenerator
8+ {
9+ public static string GenerateYomigana(string s)
10+ {
11+ var sb = new StringBuilder(s.Length * 2);
12+
13+ for (var node = MeCabFarm.DefaultTagger.ParseToNode(s).Next; node != null && node.Stat != MeCabNodeStat.Eos; node = node.Next)
14+ {
15+ sb.Append(node.GetReading() ?? node.Surface);
16+ }
17+
18+ return sb.ToString();
19+ }
20+ }
21+}
--- a/src/NMeCab.sln
+++ b/src/NMeCab.sln
@@ -19,6 +19,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibNMeCab35", "LibNMeCab35\
1919 EndProject
2020 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibNMeCab46Stream", "LibNMeCab46Stream\LibNMeCab46Stream.csproj", "{6831370D-007E-404D-BFE8-777D41514A8D}"
2121 EndProject
22+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MeCabWrapper", "MeCabWrapper\MeCabWrapper.csproj", "{DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}"
23+EndProject
2224 Global
2325 GlobalSection(SolutionConfigurationPlatforms) = preSolution
2426 Debug|Any CPU = Debug|Any CPU
@@ -111,6 +113,18 @@ Global
111113 {6831370D-007E-404D-BFE8-777D41514A8D}.Release|Mixed Platforms.Build.0 = Release|Any CPU
112114 {6831370D-007E-404D-BFE8-777D41514A8D}.Release|x86.ActiveCfg = Release|Any CPU
113115 {6831370D-007E-404D-BFE8-777D41514A8D}.Release|x86.Build.0 = Release|Any CPU
116+ {DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
117+ {DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
118+ {DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
119+ {DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
120+ {DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}.Debug|x86.ActiveCfg = Debug|Any CPU
121+ {DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}.Debug|x86.Build.0 = Debug|Any CPU
122+ {DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
123+ {DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}.Release|Any CPU.Build.0 = Release|Any CPU
124+ {DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
125+ {DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}.Release|Mixed Platforms.Build.0 = Release|Any CPU
126+ {DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}.Release|x86.ActiveCfg = Release|Any CPU
127+ {DE32DA99-6FF2-4A3F-A6DE-88F547AA6BB0}.Release|x86.Build.0 = Release|Any CPU
114128 EndGlobalSection
115129 GlobalSection(SolutionProperties) = preSolution
116130 HideSolutionNode = FALSE