yooper / php-text-analysis

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language
https://github.com/yooper/php-text-analysis/wiki
MIT License
526 stars 87 forks source link

Entity Extraction returns empty array #56

Closed Zera97 closed 4 years ago

Zera97 commented 5 years ago

Hey,

i've started working with your wrapper for the "Stanford Named Entity Extraction", but all i get returned is an empty array. Also there are no error messages.

This is my Code:

            use TextAnalysis\Taggers\StanfordNerTagger;
            use TextAnalysis\Tokenizers\WhitespaceTokenizer;

            $jarpath = [HIDDEN]/stanford-yooper/stanford-ner.jar";
            $classifierPath =[HIDDEN]/stanford-yooper/classifiers/english.all.3class.distsim.crf.ser.gz";

            $engText = "Marquette County is a county located in the Upper Peninsula of the US state of Michigan. As of the 2010 census, the population was 67,077.";

            $document = new TokensDocument((new WhitespaceTokenizer())->tokenize($engText));
            $tagger = new StanfordNerTagger($jarpath,$classifierPath);
            $output = $tagger->tag($document->getDocumentData());
            var_dump($output); //empty Array
yooper commented 5 years ago

@Zera97 , Check out the wiki article https://github.com/yooper/php-text-analysis/wiki/Entity-Extraction-with-PHP

Zera97 commented 5 years ago

Thank you for your Response!

I installed the jar and classifier manually according to the Wiki, since i couldnt figure out, how to use the command. I also tested the jar with the shell which was working.

If you could give me a some advice on how to use the shell command, i would try to install the NER files this way.

yooper commented 5 years ago

@Zera97 , I will reach out to you later today with a write up, on how to make it work.

Cheers,

jmichaelterenin commented 4 years ago

I'm about to install the jar and classifier manually myself, according to the Wiki. is there something additional I will need to know? : )

Here's a fix for your directions: php textconsole pta:package:install stanford_ner_tagger

should be: php textconsole pta:install:package stanford_ner_tagger and you need to be in the ./vendor/yooper/php-text-analysis directory.

Hopefully this helps someone else.