2017 © Pedro Peláez
 

library php-text-analysis

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

image

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

  • Thursday, July 19, 2018
  • by yooper
  • Repository
  • 33 Watchers
  • 212 Stars
  • 16,459 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 46 Forks
  • 2 Open issues
  • 28 Versions
  • 14 % Grown

The README.md

php-text-analysis

alt text, (*1)

Latest Stable Version, (*2)

Total Downloads, (*3)

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language. There are tools in this library that can perform:, (*4)

  • document classification
  • sentiment analysis
  • compare documents
  • frequency analysis
  • tokenization
  • stemming
  • collocations with Pointwise Mutual Information
  • lexical diversity
  • corpus analysis
  • text summarization

All the documentation for this project can be found in the book and wiki., (*5)

PHP Text Analysis Book & Wiki

A book is in the works and your contributions are needed. You can find the book at https://github.com/yooper/php-text-analysis-book, (*6)

Also, documentation for the library resides in the wiki, too. https://github.com/yooper/php-text-analysis/wiki, (*7)

Installation Instructions

Add PHP Text Analysis to your project, (*8)

composer require yooper/php-text-analysis

Tokenization

$tokens = tokenize($text);

You can customize which type of tokenizer to tokenize with by passing in the name of the tokenizer class, (*9)

$tokens = tokenize($text, \TextAnalysis\Tokenizers\PennTreeBankTokenizer::class);

The default tokenizer is \TextAnalysis\Tokenizers\GeneralTokenizer::class . Some tokenizers require parameters to be set upon instantiation., (*10)

Normalization

By default, normalize_tokens uses the function strtolower to lowercase all the tokens. To customize the normalize function, pass in either a function or a string to be used by array_map., (*11)

$normalizedTokens = normalize_tokens(array $tokens); 
$normalizedTokens = normalize_tokens(array $tokens, 'mb_strtolower');

$normalizedTokens = normalize_tokens(array $tokens, function($token){ return mb_strtoupper($token); });

Frequency Distributions

The call to freq_dist returns a FreqDist instance., (*12)

$freqDist = freq_dist(tokenize($text));

Ngram Generation

By default bigrams are generated., (*13)

$bigrams = ngrams($tokens);

Customize the ngrams, (*14)

// create trigrams with a pipe delimiter in between each word
$trigrams = ngrams($tokens,3, '|');

Stemming

By default stem method uses the Porter Stemmer., (*15)

$stemmedTokens = stem($tokens);

You can customize which type of stemmer to use by passing in the name of the stemmer class name, (*16)

$stemmedTokens = stem($tokens, \TextAnalysis\Stemmers\MorphStemmer::class);

Keyword Extract with Rake

There is a short cut method for using the Rake algorithm. You will need to clean your data prior to using. Second parameter is the ngram size of your keywords to extract., (*17)

$rake = rake($tokens, 3);
$results = $rake->getKeywordScores();

Sentiment Analysis with Vader

Need Sentiment Analysis with PHP Use Vader, https://github.com/cjhutto/vaderSentiment . The PHP implementation can be invoked easily. Just normalize your data before hand., (*18)

$sentimentScores = vader($tokens);

Document Classification with Naive Bayes

Need to do some document classification with PHP, trying using the Naive Bayes implementation. An example of classifying movie reviews can be found in the unit tests, (*19)

$nb = naive_bayes();
$nb->train('mexican', tokenize('taco nacho enchilada burrito'));        
$nb->train('american', tokenize('hamburger burger fries pop'));  
$nb->predict(tokenize('my favorite food is a burrito'));

The Versions

19/07 2018

dev-master

9999999-dev

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

MIT Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis text classification

19/07 2018

1.4

1.4.0.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis text classification

19/07 2018

dev-sentence_summarizer

dev-sentence_summarizer

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis text classification

20/06 2018

dev-bayes

dev-bayes

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis text classification

13/06 2018

1.3.7

1.3.7.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis text classification

18/05 2018

1.3.6

1.3.6.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

27/03 2018

1.3.5

1.3.5.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

08/03 2018

1.3.4

1.3.4.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

16/02 2018

dev-add-license-1

dev-add-license-1

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

16/02 2018

1.3.3

1.3.3.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

16/02 2018

dev-fix_laravel_56

dev-fix_laravel_56

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

MIT

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

15/02 2018

1.3.2

1.3.2.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache-2.0

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

15/02 2018

1.3.1

1.3.1.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

05/02 2018

1.3

1.3.0.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

10/01 2018

v1.2.2

1.2.2.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

10/01 2018

dev-vader_sentiment

dev-vader_sentiment

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

09/11 2017

v1.2.1

1.2.1.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

29/10 2017

v1.2

1.2.0.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

28/10 2017

dev-add_text_corpus

dev-add_text_corpus

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

06/10 2017

v1.1.3.2

1.1.3.2

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

01/03 2017

v1.1.3.1

1.1.3.1

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

27/02 2017

v1.1.3

1.1.3.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

17/02 2017

v1.1.2

1.1.2.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

07/02 2017

v1.1.1

1.1.1.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

16/01 2017

v1.1.0

1.1.0.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

05/12 2016

v1.0.1

1.0.1.0

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

14/10 2016

dev-wordnet

dev-wordnet

PHP Text Analysis is a library for performing Information Retrival (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis

26/09 2016

v1.0

1.0.0.0

PHP Text Analysis is a library for performing Information Retrival (IR) and Natural Language Processing (NLP) tasks using the PHP language

  Sources   Download

Apache 2

The Requires

 

The Development Requires

by Avatar yooper

nlp natural language processing ir text analysis