简体   繁体   English

系统错误:java.nio.file.InvalidPathException:

[英]SystemError: java.nio.file.InvalidPathException:

I'm trying to learn some Korean NLP by using KoNLPy library.我正在尝试通过使用 KoNLPy 库来学习一些韩语 NLP。 This is the code that I used:这是我使用的代码:

from konlpy.tag import Kkma  
kkma=Kkma()  
print(kkma.morphs("열심히 코딩한 당신, 연휴에는 여행을 가봐요"))

And I keep seeing this error:我一直看到这个错误:

Traceback (most recent call last):
File "c:\Study\NLP\2_tokenization.py", line 65, in <module>
kkma=Kkma()
File "C:\Users\ai\Anaconda3\lib\site-packages\konlpy\tag\_kkma.py", line 95, in __init__
jvm.init_jvm(jvmpath, max_heap_size)
File "C:\Users\ai\Anaconda3\lib\site-packages\konlpy\jvm.py", line 64, in init_jvm
jpype.startJVM(jvmpath, '-Djava.class.path=%s' % classpath,
File "C:\Users\ai\Anaconda3\lib\site-packages\jpype\_core.py", line 221, in startJVM
_jpype.startup(jvmpath, tuple(args),
SystemError: java.nio.file.InvalidPathException: Illegal char <*> at index 52: 
C:\Users\ai\Anaconda3\Lib\site-packages\konlpy\java\*

But since I'm only at the beginning level and only just familiar with python, I can't figure out why this is happening.但由于我只是处于初级阶段,并且只熟悉 python,我无法弄清楚为什么会发生这种情况。 It seems like a problem related with JAVA.这似乎是与 JAVA 相关的问题。

I had this same problem and I'm a beginner to so I nearly gave up, but I played around with some of the code in the konlpy module itself and got it working: Here's the fix:我遇到了同样的问题,我是初学者,所以我几乎放弃了,但我玩弄了 konlpy 模块本身中的一些代码并让它工作:这是修复:

  1. Go to konlpy's jvm.py file (ie "C:\Users\ai\Anaconda3\lib\site-packages\konlpy\jvm.py"). Go 到 konlpy 的 jvm.py 文件(即“C:\Users\ai\Anaconda3\lib\site-packages\konlpy\jvm.py”)。
  2. In the init_jvm function, go to the section where folder_suffix is defined.在 init_jvm function, go 到定义 folder_suffix 的部分。
  3. Under the "# Java sources" comment and the "# Twitter (Okt)" comment, there is a line with a string that contains an asterisk.在“#Java sources”注释和“#Twitter (Okt)”注释下,有一行包含一个星号的字符串。
  4. Delete those asterisks (2 total).删除那些星号(共 2 个)。

It's mmmmprobably not a perfect solution because I have no idea what those asterisks were doing there in the first place, so I'm not sure what other problems taking them out will cause.这可能不是一个完美的解决方案,因为我不知道那些星号一开始在那里做了什么,所以我不确定将它们取出会导致什么其他问题。 BUT by doing this I finally got rid of the "SystemError: java.nio.file.InvalidPathException" and was able to make an instance of the Kkma() class and use it, so if that's all you need then hopefully this is enough:]但是通过这样做,我终于摆脱了“SystemError:java.nio.file.InvalidPathException”并且能够创建 Kkma() class 的实例并使用它,所以如果这就是你所需要的,那么希望这就足够了: ]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.nio.file.InvalidPathException - java.nio.file.InvalidPathException 带有getPath的java.nio.file.InvalidPathException - java.nio.file.InvalidPathException with getPath 为什么这会抛出 java.nio.file.InvalidPathException? - Why does this throw java.nio.file.InvalidPathException? 遇到java.nio.file.InvalidPathException:非法char &lt;:&gt; - Encountering java.nio.file.InvalidPathException: Illegal char <:> java.nio.file.InvalidPathException:索引 2 处的非法字符 <:>: - java.nio.file.InvalidPathException: Illegal char <:> at index 2: java.nio.file.InvalidPathException 当路径包含冒号 (:) - java.nio.file.InvalidPathException when the path contains colon (:) Magnolia 5.4在发布/取消发布时升级java.nio.file.InvalidPathException - Magnolia 5.4 upgrade java.nio.file.InvalidPathException on publishing/unpublishing 使用闭包编译器格式化javascript文件时,在索引7处获取到java.nio.file.InvalidPathException:非法char &lt;:&gt; - Got java.nio.file.InvalidPathException:Illegal char <:> at index 7 when formatting javascript file using closure compiler java.nio.file.InvalidPathException:使用国家字符时格式错误的输入或输入包含不可映射的字符 - java.nio.file.InvalidPathException: Malformed input or input contains unmappable characters when using national characters 从 src/main/resources 读取会在命令行上给出 java.nio.file.InvalidPathException (但在 Eclipse 中工作正常) - Reading from src/main/resources gives java.nio.file.InvalidPathException on command line (but works fine in Eclipse)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM