Skip to content

Commit

Permalink
兼容 .net standard 2.0
Browse files Browse the repository at this point in the history
.net core 1.1~2.0 供 .net core 2.0 APP 使用
  • Loading branch information
Nieg committed Jun 2, 2018
1 parent b70e769 commit 665adc0
Show file tree
Hide file tree
Showing 8 changed files with 208 additions and 8 deletions.
14 changes: 14 additions & 0 deletions jieba.NET.sln
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Segmenter.Cli.Net40", "lnks
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Segmenter.Tests.Net40", "test\Segmenter.Tests.Net40\Segmenter.Tests.Net40.csproj", "{0A7BD803-0022-487B-82B6-FA5BAC286549}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Analyser.Netstandard2", "lnks_netstandard2\Analyser\Analyser.Netstandard2.csproj", "{61D14BDD-96D8-424C-8CDA-08794CBA688A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Segmenter.Netstandard2", "lnks_netstandard2\Segmenter\Segmenter.Netstandard2.csproj", "{126E178C-D42B-45F2-ABE7-BB0B47EB5634}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -81,6 +85,14 @@ Global
{0A7BD803-0022-487B-82B6-FA5BAC286549}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0A7BD803-0022-487B-82B6-FA5BAC286549}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0A7BD803-0022-487B-82B6-FA5BAC286549}.Release|Any CPU.Build.0 = Release|Any CPU
{61D14BDD-96D8-424C-8CDA-08794CBA688A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{61D14BDD-96D8-424C-8CDA-08794CBA688A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{61D14BDD-96D8-424C-8CDA-08794CBA688A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{61D14BDD-96D8-424C-8CDA-08794CBA688A}.Release|Any CPU.Build.0 = Release|Any CPU
{126E178C-D42B-45F2-ABE7-BB0B47EB5634}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{126E178C-D42B-45F2-ABE7-BB0B47EB5634}.Debug|Any CPU.Build.0 = Debug|Any CPU
{126E178C-D42B-45F2-ABE7-BB0B47EB5634}.Release|Any CPU.ActiveCfg = Release|Any CPU
{126E178C-D42B-45F2-ABE7-BB0B47EB5634}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -94,6 +106,8 @@ Global
{D80C1357-9203-4488-AD2D-B1CE2CF25A71} = {34362CA4-B5D3-4AD3-8175-5CC30F759966}
{7DC92901-69D3-483C-8D4F-DF284D6A933D} = {BFF49920-7D2B-4EC0-BE7E-6931B22A0965}
{0A7BD803-0022-487B-82B6-FA5BAC286549} = {2DD67628-A661-4B69-9E5D-0FFA087EA201}
{61D14BDD-96D8-424C-8CDA-08794CBA688A} = {A29DAC77-54EC-4F53-B2FC-00EC1C1F7756}
{126E178C-D42B-45F2-ABE7-BB0B47EB5634} = {34362CA4-B5D3-4AD3-8175-5CC30F759966}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4CCA468F-C730-4AD0-8ADE-02B8CEA55AA2}
Expand Down
54 changes: 54 additions & 0 deletions lnks_netstandard2/Analyser/Analyser.Netstandard2.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>JiebaNet.Analyser</AssemblyName>
<RootNamespace>JiebaNet.Analyser</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<OutputPath>bin\Debug\</OutputPath>
<DocumentationFile>bin\Debug\netstandard2.0\JiebaNet.Analyser.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>bin\Release\netstandard2.0\JiebaNet.Analyser.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Segmenter\Segmenter.Netstandard2.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\src\Analyser\ConfigManager.cs">
<link>ConfigManager.cs</link>
</Compile>
<Compile Include="..\..\src\Analyser\IdfLoader.cs">
<link>IdfLoader.cs</link>
</Compile>
<Compile Include="..\..\src\Analyser\KeywordExtractor.cs">
<link>KeywordExtractor.cs</link>
</Compile>
<Compile Include="..\..\src\Analyser\TextRankExtractor.cs">
<link>TextRankExtractor.cs</link>
</Compile>
<Compile Include="..\..\src\Analyser\TfidfExtractor.cs">
<link>TfidfExtractor.cs</link>
</Compile>
<Compile Include="..\..\src\Analyser\Properties\AssemblyInfo.cs">
<link>Properties\AssemblyInfo</link>
</Compile>
<Compile Include="..\..\src\Analyser\UndirectWeightedGraph.cs">
<link>UndirectWeightedGraph.cs</link>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="..\..\content\Resources\idf.txt">
<link>Resources\idf.txt</link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\..\content\Resources\stopwords.txt">
<link>Resources\stopwords.txt</link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
109 changes: 109 additions & 0 deletions lnks_netstandard2/Segmenter/Segmenter.Netstandard2.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>JiebaNet.Segmenter</AssemblyName>
<RootNamespace>JiebaNet.Segmenter</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>bin\Debug\netstandard2.0\JiebaNet.Segmenter.xml</DocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>bin\Release\netstandard2.0\JiebaNet.Segmenter.xml</DocumentationFile>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="10.0.1" />
</ItemGroup>

<ItemGroup>
<Compile Include="..\..\src\Segmenter\Common\Counter.cs">
<link>Common\Counter.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\Common\Trie.cs">
<link>Common\Trie.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\ConfigManager.cs">
<link>ConfigManager.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\Constants.cs">
<link>Constants.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\Common\Extensions.cs">
<link>Common\Extensions.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\DefaultDictionary.cs">
<link>DefaultDictionary.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\FinalSeg\IFinalSeg.cs">
<link>FinalSeg\IFinalSeg.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\Node.cs">
<link>Node.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\Pair.cs">
<link>Pair.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\PosSeg\Pair.cs">
<link>PosSeg\Pair.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\PosSeg\PosSegmenter.cs">
<link>PosSeg\PosSegmenter.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\PosSeg\Viterbi.cs">
<link>PosSeg\Viterbi.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\Properties\AssemblyInfo.cs">
<link>Properties\AssemblyInfo.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\Spelling\SpellChecker.cs">
<link>Spelling\SpellChecker.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\Token.cs">
<link>Token.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\FinalSeg\Viterbi.cs">
<link>FinalSeg\Viterbi.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\WordDictionary.cs">
<link>WordDictionary.cs</link>
</Compile>
<Compile Include="..\..\src\Segmenter\JiebaSegmenter.cs">
<link>JiebaSegmenter.cs</link>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="..\..\content\Resources\dict.txt">
<link>Resources\dict.txt</link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="..\..\content\Resources\char_state_tab.json">
<link>Resources\char_state_tab.json</link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\content\Resources\pos_prob_emit.json">
<link>Resources\pos_prob_emit.json</link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\content\Resources\pos_prob_start.json">
<link>Resources\pos_prob_start.json</link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\content\Resources\pos_prob_trans.json">
<link>Resources\pos_prob_trans.json</link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\content\Resources\prob_emit.json">
<link>Resources\prob_emit.json</link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="..\..\content\Resources\prob_trans.json">
<link>Resources\prob_trans.json</link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
15 changes: 10 additions & 5 deletions src/Analyser/ConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,17 @@ public static string ConfigFileBaseDir
{
get
{
#if !NETSTANDARD2_0
var configFileDir = ConfigurationManager.AppSettings["JiebaConfigFileDir"] ?? "Resources";
if (!Path.IsPathRooted(configFileDir)) {
var domainDir = AppDomain.CurrentDomain.BaseDirectory;
configFileDir = Path.GetFullPath(Path.Combine(domainDir, configFileDir));
}
return configFileDir;
if (!Path.IsPathRooted(configFileDir))
{
var domainDir = AppDomain.CurrentDomain.BaseDirectory;
configFileDir = Path.GetFullPath(Path.Combine(domainDir, configFileDir));
}
#else
var configFileDir = "Resources";
#endif
return configFileDir;
}
}

Expand Down
7 changes: 6 additions & 1 deletion src/Analyser/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
#if !NETSTANDARD2_0
[assembly: AssemblyTitle("JiebaNet.Analyser")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("andersc")]
[assembly: AssemblyProduct("JiebaAnalyser")]
#endif

[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright © andersc 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand All @@ -33,5 +36,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
#if !NETSTANDARD2_0
[assembly: AssemblyVersion("0.39.1.0")]
[assembly: AssemblyFileVersion("0.39.1.0")]
#endif
6 changes: 5 additions & 1 deletion src/Segmenter.Cli/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
#if !NETSTANDARD2_0
[assembly: AssemblyTitle("Segmenter.Cli")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyProduct("Segmenter.Cli")]
#endif
[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand All @@ -32,5 +34,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
#if !NETSTANDARD2_0
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
#endif
4 changes: 4 additions & 0 deletions src/Segmenter/ConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ public static string ConfigFileBaseDir
{
get
{
#if !NETSTANDARD2_0
var configFileDir = ConfigurationManager.AppSettings["JiebaConfigFileDir"] ?? "Resources";
if (!Path.IsPathRooted(configFileDir))
{
var domainDir = AppDomain.CurrentDomain.BaseDirectory;
configFileDir = Path.GetFullPath(Path.Combine(domainDir, configFileDir));
}
#else
var configFileDir = "Resources";
#endif
return configFileDir;
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/Segmenter/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
#if !NETSTANDARD2_0
[assembly: AssemblyTitle("JiebaNet.Segmenter")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("andersc")]
[assembly: AssemblyProduct("JiebaSegmenter")]
#endif

[assembly: AssemblyDescription("")]
[assembly: AssemblyCopyright("Copyright © andersc 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand All @@ -33,5 +36,7 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
#if !NETSTANDARD2_0
[assembly: AssemblyVersion("0.39.1.0")]
[assembly: AssemblyFileVersion("0.39.1.0")]
#endif

0 comments on commit 665adc0

Please sign in to comment.