Code Monkey home page Code Monkey logo

Comments (3)

boudinfl avatar boudinfl commented on May 29, 2024

Hi @fatimalaoui,

The df file contains the document frequency counts (i.e. the number of documents that contain each word) and the model_file contains the parameter for the classifier.

pke only ships with pre-trained english models, so that is maybe why you are facing with issue. Nevertheless, can you give me a code snippet so I can reproduce your error?

f.

from pke.

fatimalaoui avatar fatimalaoui commented on May 29, 2024

Hi @boudinfl , Thank you for your reply.
Here is a code snippet that i use for english but that doesn't work also.
`#Kea keyphrase extraction model. Parameterized example::
import pke
from nltk.corpus import stopwords
from pke.supervised.feature_based.kea import Kea

define a list of stopwords
stoplist = stopwords.words('english')

  1. create a Kea extractor.
    extractor = Kea()

  2. load the content of the document.
    extractor.load_document(input='C-1.txt',
    language='./Programs/Python/Python37/Lib/site-packages/spacy/lang/en',
    normalization=None)

  3. select 1-3 grams that do not start or end with a stopword as
    candidates. Candidates that contain punctuation marks as words
    are discarded.
    extractor.candidate_selection(stoplist=stoplist)

  4. classify candidates as keyphrase or not keyphrase.
    df = pke.load_document_frequency_file(input_file='./Desktop/model.txt')
    model_file = './Desktop/df-semeval2010.tsv'
    extractor.candidate_weighting(self,model_file=model_file,df=df)

  5. get the 10-highest scored candidates as keyphrases
    keyphrases = extractor.get_n_best(n=10)`

  • For the df and model_file , i'm not sure what to put there exactly. (refering to the files that already exist in the package pke)

  • Here is the spacy file i have in my python directory .. is there something missing maybe or is it installed correctly?
    Capture d’écran (68)_LI

  • The error i'm getting is the following:

Could not read meta.json from C:\Users\Fatima\AppData\Local\Programs\Python\Python37\Lib\site-packages\spacy\lang\en\meta.json

from pke.

boudinfl avatar boudinfl commented on May 29, 2024

The language parameter of load_document() should be set to en. I also think you have issues with the df and model files (df should be document frequency counts and model should be a sklearn model parameters file). You can simply try to use Kea with the standard models by simply calling extractor.candidate_weighting()

from pke.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.