
Parses Twitter text, identifying and extracting components like usernames and hashtags. Facilitates text analysis by converting input into structured tokens for easy interpretation.
A Kotlin multiplatform library with 0.5.10-compatible defaults and an optional twitter-text Java 3.1.0 entity-extraction mode.
api("moe.tlaster:twitter-parser:$twitter_parser_version")
val parser = TwitterParser()
val content = "I'm using twitter parser by @MTlaster to prase twitter text #Kotlin "
val result = parser.parse(content)All existing parser options remain active, with their historical defaults and 0.5.10 parsing behavior. The twitter-text behavior is selected only when all three URL options match the configuration below. Emoji, CJK cashtags, and custom username/hashtag marks remain available as extensions in either mode.
Use this configuration for twitter-text Java 3.1.0-compatible extraction:
val twitterTextParser = TwitterParser(
enableDomainDetection = true,
enableNonAsciiInUrl = false,
enableEscapeInUrl = true,
)The result will be:
[
StringToken(value=I'm using twitter parser by ),
UserNameToken(value=@MTlaster),
StringToken(value= to prase twitter text ),
HashTagToken(value=#Kotlin), StringToken(value= )
]
Run the complete JVM throughput, allocation, batch, and concurrency benchmark:
./gradlew jvmBenchmarkThe workload set covers both legacy and twitter-text modes. Use --args=quick
for a short smoke run or --args=stress for longer batch and concurrency runs.
MIT License
Copyright (c) 2022 Tlaster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
A Kotlin multiplatform library with 0.5.10-compatible defaults and an optional twitter-text Java 3.1.0 entity-extraction mode.
api("moe.tlaster:twitter-parser:$twitter_parser_version")
val parser = TwitterParser()
val content = "I'm using twitter parser by @MTlaster to prase twitter text #Kotlin "
val result = parser.parse(content)All existing parser options remain active, with their historical defaults and 0.5.10 parsing behavior. The twitter-text behavior is selected only when all three URL options match the configuration below. Emoji, CJK cashtags, and custom username/hashtag marks remain available as extensions in either mode.
Use this configuration for twitter-text Java 3.1.0-compatible extraction:
val twitterTextParser = TwitterParser(
enableDomainDetection = true,
enableNonAsciiInUrl = false,
enableEscapeInUrl = true,
)The result will be:
[
StringToken(value=I'm using twitter parser by ),
UserNameToken(value=@MTlaster),
StringToken(value= to prase twitter text ),
HashTagToken(value=#Kotlin), StringToken(value= )
]
Run the complete JVM throughput, allocation, batch, and concurrency benchmark:
./gradlew jvmBenchmarkThe workload set covers both legacy and twitter-text modes. Use --args=quick
for a short smoke run or --args=stress for longer batch and concurrency runs.
MIT License
Copyright (c) 2022 Tlaster
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.