Skip to content

Commit

Permalink
FEAT 支持在当前目录下读取自定义JSON文件,文件名为AddressParsingRegions.json
Browse files Browse the repository at this point in the history
  • Loading branch information
zyuan committed Feb 28, 2024
1 parent 10791ea commit ba6dd82
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/Demo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public static string GetSpellCode(string value)

static void Main(string[] args)
{
TestSpellSearch();
//TestSpellSearch();

//TestParser();
TestParser();

Console.ReadKey();
}
Expand Down
4 changes: 2 additions & 2 deletions src/AddressParsing/AddressParsing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<Description>C# 实现的一个地址归一化算法,将地址匹配到 省-市-区,最快每秒可处理10w+地址</Description>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Version>2.5.0</Version>
<AssemblyVersion>2.5.0.0</AssemblyVersion>
<Version>2.5.1</Version>
<AssemblyVersion>2.5.1.0</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
Expand Down
6 changes: 6 additions & 0 deletions src/AddressParsing/BasicData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ static BasicData()

private static string ReadRegionsFile()
{
var curpath = Path.Combine(Directory.GetCurrentDirectory(), "AddressParsingRegions.json");
if (File.Exists(curpath))
{
return File.ReadAllText(curpath);
}

using (Stream sm = Assembly.GetExecutingAssembly().GetManifestResourceStream($"{Assembly.GetExecutingAssembly().GetName().Name}.Internal.Regions.json"))
{
if (sm == null)
Expand Down

0 comments on commit ba6dd82

Please sign in to comment.