Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dotnet CLI does not add dic directory automatically #3

Closed
tani opened this issue Oct 26, 2020 · 2 comments
Closed

dotnet CLI does not add dic directory automatically #3

tani opened this issue Oct 26, 2020 · 2 comments

Comments

@tani
Copy link

tani commented Oct 26, 2020

Hi, there. Thank you for the great library.
When I add this pacakge to my project, I found that the dotnet CLI did not add dic directory.
I guess I missed some steps, however I could not get them.
Please show me how I should treat this issue.

Steps

$ dotnet new MeCabTest --language=F#
$ dotnet add package MeCab.DotNet
$ vi Program.fs
$ cat Program.fs
open System
open MeCab

[<EntryPoint>]
let main argv =
    let input = "行く川のながれは絶えずして、しかももとの水にあらず。"
    let tagger = MeCabTagger.Create (MeCabParam())
    input
        |> tagger.ParseToNodes
        |> Seq.filter (fun node -> node.CharType > 0u)
        |> Seq.map (fun node -> node.Feature.Split ',')
        |> Seq.iter (fun features -> printf "%s" features.[7])
    0
$ dotnet run
Unhandled exception. System.IO.DirectoryNotFoundException: Could not find a part of the path '/home/********/Documents/MeCabTest/dic/char.bin'.
   at Interop.ThrowExceptionForIoErrno(ErrorInfo errorInfo, String path, Boolean isDirectory, Func`2 errorRewriter)
   at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String path, OpenFlags flags, Int32 mode)
   at System.IO.FileStream.OpenHandle(FileMode mode, FileShare share, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access)
   at MeCab.Core.CharProperty.Open(String dicDir)
   at MeCab.Core.Tokenizer.Open(MeCabParam param)
   at MeCab.Core.Viterbi.Open(MeCabParam param)
   at MeCab.MeCabTagger.Open(MeCabParam param)
   at MeCab.MeCabTagger.Create(MeCabParam param)
   at Program.main(String[] argv) in /home/********/Documents/MeCabTest/Program.fs:line 7
@kekyo
Copy link
Owner

kekyo commented Nov 22, 2020

@tani Thank you reported and sorry late response. I fixed this problem and released new NuGet package versioned 0.0.30. Could you test it?

@tani
Copy link
Author

tani commented Nov 23, 2020

Thank you for excellent updates!
I tested it and it works well. I also report you that I conformed it with .NET 5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants