PHP Classes
elePHPant
Icontem

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

Recommend this page to a friend!
  Info   View files Documentation   View files View files (16)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-11-30 (5 days ago) RSS 2.0 feedNot yet rated by the usersTotal: 10 This week: 10All time: 9,773 This week: 25Up
Version License PHP version Categories
laravel-grammar 1.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.

  Performance   Level  
Name: Zacchaeus Bolaji <contact>
Classes: 6 packages by
Country: Nigeria Nigeria
Innovation award
Innovation award
Nominee: 1x

 

Details

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

  • Runphp 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  
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  /  .circleci  
File Role Description
  Accessible without login Plain text file config.yml Data Auxiliary data

  Files folder image Files  /  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  /  src  /  config  
File Role Description
  Accessible without login Plain text file laravel-grammar.php Conf. Configuration script

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

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

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

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

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

  Files folder image Files  /  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

 Version Control Unique User Downloads Download Rankings  
 100%
Total:10
This week:10
All time:9,773
This week:25Up