PHP Classes

Laravel Grammar: Detect the type of a given word in a sentence

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 56 All time: 10,579 This week: 455Up
Version License PHP version Categories
laravel-grammar 1.0.0The PHP License5PHP 5, Text processing, Libraries
Description 

Author

This package can detect the type of a given word in a sentence.

It is a service provider package for the Laravel framework that can take a word that may have been extracted from a sentence and tells the type of word that it is in the grammar.

The package can also return the list of types of word that it can detect. Currently it can detect words that can be of type: preposition, noun, pronoun, adverb, adjective, verb, interjection and conjunction.

Innovation Award
PHP Programming Innovation award nominee
December 2019
Number 10
Each word in a sentence may be of a certain type that must be correct so the grammar of a sentence is also correct.

This package determines the type of each given word, so applications can determine the role of each word and verify if the grammar of the sentence is correct.

Manuel Lemos
Picture of Zacchaeus Bolaji
  Performance   Level  
Name: Zacchaeus Bolaji <contact>
Classes: 17 packages by
Country: Nigeria Nigeria
Age: ???
All time rank: 245515 in Nigeria Nigeria
Week rank: 287 Up9 in Nigeria Nigeria Up
Innovation award
Innovation award
Nominee: 12x

Winner: 1x

Documentation

Laravel Grammar

CircleCI Latest Stable Version Total Downloads License Scrutinizer Code Quality Code Intelligence Status Maintainability StyleCI Code Coverage

Laravel Grammar allows you detect the part of speech of a word. It returns an array of parts of speech a word belong to.

Installation

Step 1

You can install the package via composer:

composer require djunehor/laravel-grammar

Laravel 5.5 and above

The package will automatically register itself, so you can start using it immediately.

Laravel 5.4 and older

In Laravel version 5.4 and older, you have to add the service provider in config/app.php file manually:

'providers' => [
    // ...
    Djunehor\Grammar\GrammarServiceProvider::class,
];

Lumen

After installing the package, you will have to register it in bootstrap/app.php file manually:

// Register Service Providers
    // ...
    $app->register(Djunehor\Grammar\GrammarServiceProvider::class);
];

Step 2 - Publishing files

Run: php artisan vendor:publish --tag=laravel-grammar This will move the migration file, seeder file and config file to your app. You can change the entries table name in config/laravel-grammar.php

Step 3 - Publishing files

  • Run`php artisan migrate` to create the table.
  • Run `php artisan db:seed --class=LaravelGrammarSeeder` to seed table

Usage

use Djunehor\Grammar\Word;`

$grammar = new Word();

Get All Parts of Speech

$partsOfSpeech = $grammar->getPartsOfSpeech();
// ['Preposition', 'Noun', 'Pronoun', 'Adverb', 'Adjective', 'Verb', 'Interjection', 'Conjunction']

Get Word part of Speech

$word = 'boy';
$partsOfSpeech = $grammar->getWordPartOfSpeech($word);
// ['Noun']

Check if is noun

$word = 'boy';
$grammar = new Word($string);
$isNoun = $grammar->isNoun();
// true

Using Facade

In order to use the Grammar facade: - First add 'Grammar' => GrammarFacade::class, to aliases in config/app.php - Then use like \Grammar::getPartsOfSpeech();

Contributing

  • Fork this project
  • Clone to your repo
  • Make your changes and run tests `composer test`
  • Push and create Pull request

  Files folder image Files (16)  
File Role Description
Files folder image.circleci (1 file)
Files folder imagesrc (2 files, 4 directories)
Files folder imagetests (3 files)
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .styleci.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (16)  /  .circleci  
File Role Description
  Accessible without login Plain text file config.yml Data Auxiliary data

  Files folder image Files (16)  /  src  
File Role Description
Files folder imageconfig (1 file)
Files folder imagedatabase (2 directories)
Files folder imageFacades (1 file)
Files folder imageHelpers (1 file)
  Plain text file GrammarServiceProvider.php Class Class source
  Plain text file Word.php Class Class source

  Files folder image Files (16)  /  src  /  config  
File Role Description
  Accessible without login Plain text file laravel-grammar.php Conf. Configuration script

  Files folder image Files (16)  /  src  /  database  
File Role Description
Files folder imagemigrations (1 file)
Files folder imageseeds (1 file)

  Files folder image Files (16)  /  src  /  database  /  migrations  
File Role Description
  Plain text file 2019_11_22_145649_...ords_table.php.stub Class Class source

  Files folder image Files (16)  /  src  /  database  /  seeds  
File Role Description
  Plain text file LaravelGrammarSeeder.php.stub Class Class source

  Files folder image Files (16)  /  src  /  Facades  
File Role Description
  Plain text file GrammarFacade.php Class Class source

  Files folder image Files (16)  /  src  /  Helpers  
File Role Description
  Accessible without login Plain text file helpers.php Example Example script

  Files folder image Files (16)  /  tests  
File Role Description
  Plain text file GrammarServiceProviderTest.php Class Class source
  Plain text file GrammarTest.php Class Class source
  Plain text file TestCase.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:56
This week:0
All time:10,579
This week:455Up