Download the PHP package writecrow/tag_converter without Composer
On this page you can find all versions of the php package writecrow/tag_converter. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download writecrow/tag_converter
More information about writecrow/tag_converter
Files in writecrow/tag_converter
Package tag_converter
Short Description Converts tagged textfiles to JSON, PHP or XML
License MIT
Homepage https://tag-converter.markfullmer.com/
Informations about the package tag_converter
Corpus-tagged Text Converter
A PHP library for converting files tagged with corpus metadata to JSON, PHP, or XML.
History
Corpus linguistics researchers use a markup-like syntax to provide metadata about texts. For consumption by applications, this syntax needs to be converted into a more universal, machine-readable format. The format chosen was JSON.
Basic Usage
The included /demo/index.php
file contains a conversion form demonstration.
Make your code aware of the TagConverter class via your favorite method (e.g.,
use
or require
)
Then pass a string of text into the class:
Expected input format
The corpus style tagging syntax expected by the library is defined as follows:
- Tags must be wrapped in and
- Tag names and tag values may only alphanumeric characters, spaces, underscores, and hypens.
- Tag names must be separated from tag values by a
- Spaces at the beginning at end of tag names or tag values are ignored; spaces within tag values will be preserved
- Everything not wrapped in and will be considered "text"
Status | Tag Example | Explanation |
---|---|---|
Good | ||
Good | Spaces in tag names & values OK | |
Good | Spaces padding tag names & values OK | |
Good | Underscores & hyphens OK | |
Good | Pipe separators for multiple values | |
Good | Semicolon separators for multiple values | |
Bad | Other characters not OK |
Testing
Unit Tests can be run (after ) by executing