Proxem 的 Antelope:找不到接口“ISentenceSplitter”

发布于 2024-10-29 20:32:09 字数 901 浏览 5 评论 0原文

我需要在基于 C# 的桌面应用程序中对用户输入的各种文本进行一些自然语言处理。我正在使用羚羊来达到这个目的。第一步是将文本分成句子。按照 Antelope 提供的文档,我使用了:

using Proxem.Antelope;
using Proxem.Antelope.Lexicon;
using Proxem.Antelope.Tools;
using Proxem.Antelope.LinkGrammar;
using Proxem.Antelope.Stanford;
using NUnit.Framework;
...
...
...
ISentenceSplitter splitter = new Tools.MIL_HtmlSentenceSplitter();
splitter.Text = text;
foreach (string sentence in splitter.Sentences)
{
    // Process sentence…
}

另外,我还添加了对这些库的引用。但它给出了错误

The type or namespace name 'ISentenceSplitter' could not be found (are you missing a using directive or an assembly reference?) C:\Users\...

The type or namespace name 'Tools' could not be found (are you missing a using directive or an assembly reference?) C:\Users\...

我似乎无法找出解决方案。在网上搜索后,我发现其他人也遇到了这个问题,但没有人能真正找到解决方案。你们能帮我吗?

I need to do some Natural Language Processing on various text inputs from user in a C# based desktop application. I am using Antelope for this purpose. The first step is to split the text into sentences. Following the documentation provided by Antelope, I used:

using Proxem.Antelope;
using Proxem.Antelope.Lexicon;
using Proxem.Antelope.Tools;
using Proxem.Antelope.LinkGrammar;
using Proxem.Antelope.Stanford;
using NUnit.Framework;
...
...
...
ISentenceSplitter splitter = new Tools.MIL_HtmlSentenceSplitter();
splitter.Text = text;
foreach (string sentence in splitter.Sentences)
{
    // Process sentence…
}

Also, I have added references to these libraries as well. But it gives the error

The type or namespace name 'ISentenceSplitter' could not be found (are you missing a using directive or an assembly reference?) C:\Users\...

and

The type or namespace name 'Tools' could not be found (are you missing a using directive or an assembly reference?) C:\Users\...

I can't seem to figure out the solution. After a search on net I found out that other people are also having this problem but no one could actually found a solution. Can you please help me guys?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

萌面超妹 2024-11-05 20:32:09

简单的答案是避免使用这个库。无意冒犯作者,他们可能已经做了很好的努力,但如果经过各种可能的尝试后仍无法使用,那么它就没用了。他们在文档中提到一个函数属于一个特定的接口,但是当你去那里时,它不存在于任何可用的接口中。

对于那些好奇的人:我确实通过他们的网站联系了作者,但即使在 8 天后也没有得到回复。

还有其他可用的替代方案,例如 OpenNLP (java) 或其 C# 对应项 SharpNLP

Simple answer is to avoid using this library. No offense to the authors, they might have done v.good and hard work but if it can not be utilized after all kinds of possible tries then it is useless. They mention in doc that a function belongs to a particular interface but when you go there, it doesn't exist in ANY of the available interfaces.

For those who are curious: I did contact the authors through their site but didn't get a reply even after 8 days.

There are other alternatives available like OpenNLP (java) or its C# counterpart SharpNLP.

篱下浅笙歌 2024-11-05 20:32:09

我也有同样的问题。它源于以下事实:antelope dll 兼容
.net Framework 2.0 并且您的应用程序设置为使用 .net 4.0。 (可能)
我将应用程序更改为.net 2.0,问题就消失了。 :)

另外我还使用过 SharpNLP 和 Antelope。羚羊具有一些优越的功能,例如
折叠检测和移植到 wordnet,这是我在 SharpNLP 中没有见过的。

祝你好运。

I had the same problem. It stems from the fact that antelope dlls are compatible with
.net framework 2.0 and your application is set to use .net 4.0. (possibly)
I changed my application to .net 2.0 and trouble disappeared. :)

In addition I have used both SharpNLP and Antelope. Antelope has some superior features like
Collapse detection and port to wordnet which I had not seen in SharpNLP.

good luck.

一萌ing 2024-11-05 20:32:09

对于这个问题的答案非常简单:ISentenceSplitter 不在实际版本中。我有 v 0.8.7,它应该与其他人都有的免费 2009 版本相同。为了确认这一点,我做了一个

grep -r ISentenceSplitter .

,但没有任何结果。尝试使用另一个确实存在的接口(例如 ILexicon)进行 grep,您会看到包含 ILexicon 的所有 dll。

请注意,我们谈论的是免费版本,Proxem 与其他合理的公司一样,希望将其技术作为盈利企业进行营销。因此,你必须对你所拥有的感到满意,研究付费解决方案,使用其他东西或编写你自己的库,社区会很高兴拥有这些库。

Quite simple answer to this one: ISentenceSplitter is not in the actual release. I have v 0.8.7 which should be the same free 2009 version everyone else has To confirm this, I did a

grep -r ISentenceSplitter .

and nothing came back. Try to grep with another interface that does exist such as ILexicon and you see all the dlls that contain ILexicon.

Note that we are talking about a free version and Proxem, like other reasonable companies, want to market their technology as a profitable enterprise. Therefore you have to be happy with what you have, look into the paid solutions, use something else or write your own library which the community would be very happy to have.

何必那么矫情 2024-11-05 20:32:09

我遇到了同样的错误。 Sali Hoo 有真正的正确答案。 这不是如何查找或使用 ISentenceSplitter 的答案;然而,它确实展示了 Proxem 的示例应用程序如何将句子拆分为更大流程的一部分。

库附带的示例应用程序可以分割句子,所以我认为代码允许这样做。阅读了一些代码后,我发现他们的示例使用 Proxem.Antelope.Document 类进行句子分割和句法解析。我没有反编译库来查看 Document 构造函数的内部如何使用 ISentenceSplitter (我对此相当有信心),我只是使用了该类,它实际上最终结束了执行我需要的所有功能,而不仅仅是句子分割。我绝对建议您看看他们的示例如何使用它,但这是我的实现的本质:

public sealed class SyntaxService : ISyntaxService
{
    public SyntaxService(IParser parser, ILexicon lexicon)
    {
        m_parser = parser;
        m_lexicon = lexicon;

        // These are the setting I needed, YMMV.  They seem to add a lot of UI logic to this method :(
        m_processingResources = new ProcessingResources(m_lexicon, null, null, m_parser, 5, null, false, null, null, null, null, false);
    }

    public IEnumerable<Sentence> GetSentences(string s)
    {
        IDocument document = new Document(s, m_processingResources);

        return document.Select(Mappers.SentenceMapper.Map);
    }

    readonly IParser m_parser;
    readonly ILexicon m_lexicon;
    readonly IProcessingResources m_processingResources;
}

此处引用的 Sentence 类是一个简化的语法树以及原始句子值。如果您对这种类型的依赖注入友好包装和映射不是很感兴趣,您可以直接使用 GetSentences(string) 的内容。

I ran into that same error. Sali Hoo has the actual correct answer. This is not an answer for how to find or use ISentenceSplitter; however, it does show how Proxem's example application splits sentences as part of a larger process.

The example application that ships with the libraries can split sentences, so I figured the code allows for it. After reading a bit of code, I found that their example uses the Proxem.Antelope.Document class for sentence splitting and syntactical parsing. Rather than decompiling the libraries to see how the guts of the Document constructor uses ISentenceSplitter (I'm fairly confident that it does) I just used the class and it actually ended up performing all of the functions I needed, not just sentence splitting. I definitely recommend taking a look at how their example uses it, but here's the essence of my implementation:

public sealed class SyntaxService : ISyntaxService
{
    public SyntaxService(IParser parser, ILexicon lexicon)
    {
        m_parser = parser;
        m_lexicon = lexicon;

        // These are the setting I needed, YMMV.  They seem to add a lot of UI logic to this method :(
        m_processingResources = new ProcessingResources(m_lexicon, null, null, m_parser, 5, null, false, null, null, null, null, false);
    }

    public IEnumerable<Sentence> GetSentences(string s)
    {
        IDocument document = new Document(s, m_processingResources);

        return document.Select(Mappers.SentenceMapper.Map);
    }

    readonly IParser m_parser;
    readonly ILexicon m_lexicon;
    readonly IProcessingResources m_processingResources;
}

The Sentence class referenced here is a simplified syntax tree along with the original sentence value. If you're not super interested in this type of dependency injection friendly wrapping and mapping, you can just use the guts of GetSentences(string).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文