twitter_parser
twitter_parser · Minimal C full-text-search parser that tokenizes Twitter-style hashtags and mentions.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100408 | twitter_parser | twitter_parser | 1.0 | FTS | Unknown | C |
Usage
Sources:
twitter_parser is an unfinished full-text-search parser prototype for recognizing Twitter-style @mention and #hashtag tokens. Creating the extension registers a parser named twitterparser; it does not create a ready-to-use text search configuration.
Core Workflow
Use the parser introspection functions to evaluate it before considering a configuration:
The parser advertises token ID 24 as mention and token ID 25 as hashtag. A text search configuration would also need dictionary mappings for those aliases, but this prototype is not complete enough for production indexing.
Object Index
- Text search parser
twitterparserprovides start, token, end, headline, and token-type callbacks. - Token type
mention(24) is intended for text beginning with@. - Token type
hashtag(25) is intended for text beginning with#. twitterprs_start,twitterprs_getlexeme,twitterprs_end, andtwitterprs_lextypeare low-level parser support functions, not application APIs.
Operational Notes
Version 1.0 is relocatable and declares no dependency or preload requirement. Upstream labels it WIP. The implementation consumes a hashtag or mention only until an ASCII space; it does not validate punctuation or Unicode rules. More importantly, it does not advance over spaces or ordinary text and leaves the token type unset on such input, so mixed sentences can stop early or behave unpredictably.
Do not build durable text-search indexes with this parser without repairing and testing its state machine. Test malformed input, multiple tokens, punctuation, multibyte text, headline generation, upgrades, and reindexing in an isolated database. For production, use a maintained parser or normalize hashtags and mentions into separate indexed columns.