小编Rod*_*kar的帖子

运行斯坦福提供的开放信息提取时出错

我正在尝试使用官方网站上给出的命令运行stanford nlp给出的openIE:http://nlp.stanford.edu/software/openie.shtml

java -mx1g -cp stanford-openie.jar:stanford-openie-models.jar edu.stanford.nlp.naturalli.OpenIE  mytextfile.txt
Run Code Online (Sandbox Code Playgroud)

但我收到以下错误:

Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at edu.stanford.nlp.pipeline.StanfordCoreNLP.<clinit>(StanfordCoreNLP.java:99)
at edu.stanford.nlp.naturalli.OpenIE.main(OpenIE.java:679)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 2 more
Run Code Online (Sandbox Code Playgroud)

当我运行给出的java代码时:

package edu.stanford.nlp.naturalli;

import edu.stanford.nlp.ie.util.RelationTriple;
import edu.stanford.nlp.ling.CoreAnnotations;
import edu.stanford.nlp.pipeline.Annotation;
import edu.stanford.nlp.pipeline.StanfordCoreNLP;
import edu.stanford.nlp.util.CoreMap;

import java.util.Collection;
import java.util.List;
import java.util.Properties;

public class OpenIEDemo {

public static void main(String[] args) throws Exception {
// Create the Stanford CoreNLP pipeline
Properties props = new Properties();
props.setProperty("annotators", …
Run Code Online (Sandbox Code Playgroud)

stanford-nlp

6
推荐指数
1
解决办法
2236
查看次数

在django中过滤嵌套(外键)查询集

我在 Django 中有一个查询集:

    models.User:
       id = pk
       username = text

    models.Offer
       id = pk
       user = Fk(User)
       description = text

    my serializer is:

    class UserOfferSerializer(ModelSerializer):
        offers = OfferSerializerAll(many=True, read_only=True)
        class Meta:
            model = User
            fields = ('id', 'username', 'offers')
Run Code Online (Sandbox Code Playgroud)

我试图通过描述文本中出现的一段文本来过滤它,这很简单(过滤第一级对象,即用户),但随后我想过滤每个用户的报价并返回具有所需的用户优惠。我在尝试:

queryset.filter(offers__description__icontains = sometext)
Run Code Online (Sandbox Code Playgroud)

但我向用户提供了他拥有的所有优惠。

任何帮助,谢谢!

django django-queryset

2
推荐指数
1
解决办法
3971
查看次数

标签 统计

django ×1

django-queryset ×1

stanford-nlp ×1