Coder Social home page Coder Social logo

forkarea / php-text-analysis Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yooper/php-text-analysis

0.0 2.0 0.0 666 KB

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

Home Page: https://github.com/yooper/php-text-analysis/wiki

PHP 100.00%

php-text-analysis's Introduction

php-text-analysis

alt text

Latest Stable Version

Total Downloads

Latest Unstable Version

PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language. All the documentation for this project can be found in the wiki.

Installation Instructions

Add PHP Text Analysis to your project

composer require yooper/php-text-analysis

Documentation for the library resides in the wiki. https://github.com/yooper/php-text-analysis/wiki

Dictionary Installation

Not required unless you use the dictionary stemmers

For Ubuntu < 16

sudo apt-get install libpspell-dev 
sudo apt-get install php5-pspell
sudo apt-get install aspell-en
sudo apt-get install php5-enchant

For Ubuntu >= 16

sudo apt-get install libpspell-dev php7.0-pspell aspell-en php7.0-enchant

For Centos

sudo yum install php5-pspell
sudo yum install aspell-en
sudo yum install php5-enchant

PHP Pecl Stem is not currently available in php 7.0.

Tokenize

There are several tokenizers available

  • FixedLengthTokenizer
  • GeneralTokenizer
  • LambdaTokenizer
  • PennTreeBankTokenizer
  • RegexTokenizer
  • SentenceTokenizer
  • WhitespaceTokenizer

Tokenizer Usage

$tokenizer = new GeneralTokenizer()
$tokens = $tokenizer->tokenize("Enter your text here");

Frequency Distribution

$tokenizer = new \TextAnalysis\Tokenizers\GeneralTokenizer();
$tokens = $tokenizer->tokenize("time flies like an arrow and an arrow flies like time");
$freqDist = new \TextAnalysis\Analysis\FreqDist($tokens);
$freqDist->getHapaxes(); //Get the Hapaxes
$freqDist->getTotalTokens();
$freqDist->getTotalUniqueTokens();

Check out the API for full documentation https://github.com/yooper/php-text-analysis/blob/master/src/Analysis/FreqDist.php

php-text-analysis's People

Contributors

yooper avatar maxguru avatar

Watchers

James Cloos avatar Andrzej Kostrzewa avatar

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.