Download the PHP package vanderlee/php-sentence without Composer

On this page you can find all versions of the php package vanderlee/php-sentence. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package php-sentence

Sentence

[License]() Build Status Quality

Version 1.0.8

Copyright © 2016-2024 Martijn van der Lee (@vanderlee), parts copyright © 2017 @marktaw.

MIT Open Source license applies.

Introduction

PHP natural language sentence segmentation (splitting) and counting. Sentence boundary disambiguation.

Still early, but should support most western languages. If you find any problems, please let me know.

Supports PHP 5.3 and up, so you can use it on older servers.

Installation

Requires PHP 5.4 or greater. PHP 5.3 is supported as long as no more recent features are absolutely necessary.

To install using Composer:

composer require vanderlee/php-sentence

Methods

integer count(string $text)

Counts the number of sentences in the text. Provided for convenience; this is exactly the same as counting the number of returned array items from split, so if you need both results, just do that.

array split(string $text,integer $flags = 0)

Splits the text into sentences.

$flags is zero (0, default) or the following class constant:

Documentation

You can find documentation generated from the source code by ApiGen here: ApiGen documentation

Examples

How it works

The method used is not based on any on the established or published methods. It seems to work pretty well, though.

The method follows a number of simple steps in splitting and re-merging the text into full sentences. You can easily check the steps in the code.

Though the splitting may be a bit off, in particular abbreviations at the start of sentences tend to be merged with the preceding sentences. In most ordinary text this should pose no problem. In either case this should not affect the sentence count except in very uncommon situations.

It should be noted that this algorithm depends on reasonably gramatically correct punctuation. Do not L33t-5p3ak!!!!!1!1!11!eleven!!

Rules

The following is a rough list of the rules used to split sentences.


All versions of php-sentence with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
ext-mbstring Version *
ext-ctype Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package vanderlee/php-sentence contains the following files

Loading the files please wait ....