Download .zip |
Info | Example | View files (3) | Download .zip | Reputation | Support forum | Blog | Links |
Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
2018-06-29 (2 months ago) | Not yet rated by the users | Total: 66 This week: 66 | All time: 9,211 This week: 14 |
Version | License | PHP version | Categories | |||
fgetword 1.0.0 | The PHP License | 5 | PHP 5, Files and Folders, Text proces... |
Description | Author | |
This class can process the text of a file word by word. |
This package extends the basic PHP files system functions with some simple but useful functions: -fgetword acts exactly as fgetc or fgets but return instead a word from the chosen file resource -yieldWordsFromFile is a generator useful to yield word from file until there is no more word left -countWordsInFile use the yieldWordsFromFile generator and increment a counter to finally return the number of words in a file -yieldWordsFromDir generator useful to yield word from directory until there is no more word left -countWordsInDir use the yieldWordsFromDir generator and increment a counter to finally return the number of words in a directory -wordsOccurrences return an array of words occurrences contained in a file or a directory sorted alphabetically or by number of occurrences descending or just by order of appearance.The returned value of this function is an array where each found file is linked to related words sorted as said above. It can be useful mainly to index file and its contents.Each word is associated to the number of occurrences. the different functions also get an optional filter argument: Its purpose is to allow custom word filtering via callback for example : you can use a spell check database or any dictionary to make the class ignore some words the design of such function is simple.It must only take one argument(the word) and must return true if the word is accepted and false if it is rejected. Indeed the package has its own definition of what is a word but this must not prevent you to specify your criteria according to the goal your are trying to achieve.That is why the filter option exists. You can of course extend the class to completely rewrite the fgetword function or just use the code as inspirational example to build something great. |
Files |
File | Role | Description |
---|---|---|
fgetwordTest.php | Example | example script |
fgw.class.php | Class | class source |
readme.txt | Doc. | readme |
Version Control | Unique User Downloads | Download Rankings | |||||||||||||||
0% |
|
|
Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.