gpt4 book ai didi

stanford-nlp - 管道定义上的类型初始化异常

转载 作者:行者123 更新时间:2023-12-02 00:58:22 25 4
gpt4 key购买 nike

将 Stanford-NLP 集成到 ASP.Net Core C# 应用程序中时出现以下错误消息:System.TypeInitializationException HResult=0x80131534 Message='edu.stanford.nlp.util.Timing' 的类型初始值设定项抛出异常。 来源=stanford-corenlp-3.9.1 堆栈跟踪: 在 edu.stanford.nlp.util.Timing..ctor() 在 edu.stanford.nlp.pipeline.StanfordCoreNLP.construct(属性, bool 值,AnnotatorImplementations) 在 edu.stanford.nlp.pipeline.StanfordCoreNLP..ctor(Properties props,Boolean enforceRequirements,AnnotatorPool annotatorPool) 在 edu.stanford.nlp.pipeline.StanfordCoreNLP..ctor(Properties props,Boolean enforceRequirements) 在 edu.stanford.nlp.pipeline.StanfordCoreNLP..ctor(属性 Prop ) 在 _3x32018.Utility.SearchNLP.ParseNLG(String sent2) 在 G:\VSProjects\3x32018\3x32018\Utility\SearchNLP.cs:line 52

内部异常 1:TypeInitializationException:“java.util.ResourceBundle”的类型初始值设定项引发异常。

内部异常 2:MissingMethodException: 未找到方法:'Void System.IO.FileStream..ctor(System.String, System.IO.FileMode, System.Security.AccessControl.FileSystemRights, System.IO.FileShare, Int32, System.IO.FileOptions)' .

这是我的简单代码::

using edu.stanford.nlp.pipeline;
using java.util;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;

namespace _3x32018.Utility
{
public class SearchNLP
{
public HashSet<string> ParseNLG(string sent2)
{
CultureInfo ci = new CultureInfo("en-US");
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.CurrentUICulture = ci;

Properties props = new Properties();
props.setProperty("annotators", "tokenize, ssplit, pos, lemma,
ner, parse, dcoref");
StanfordCoreNLP pipeline = new StanfordCoreNLP(props);
Annotation document = new Annotation(sent2);
pipeline.annotate(document);
}
}
}

知道为什么会失败吗?

-莱斯特

最佳答案

您使用的 ASP.NET Core 没有 corenlp.net 正在使用的 FileStream 的构造函数(确切地说是 IKVM)。查看此页面,https://learn.microsoft.com/en-us/dotnet/api/system.io.filestream.-ctor?view=netcore-2.0 .

关于stanford-nlp - 管道定义上的类型初始化异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52560894/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com