WHAT IS TEXTGLASS?
TextGlass is a text classification project. This encompasses things like device, browser, OS detection, and even WAF rules. Give TextGlass a string (like a HTTP User-Agent request header) and it will tell you what it is.
TextGlass has extended the idea of classification into generic JSON domains. The domain tells the TextGlass client how to classify the input into a result. This will allow this project and 3rd parties to create their own domains and use them with standard TextGlass clients. This also allows you to a run a domain across a large variety of languages and platforms and achieve identical results.
TextGlass has client support for the following languages:
TextGlass supports the following platforms:
We are looking to expand our language and platform offering, so reach out if you would like to help.
TextGlass provides the following domains:
Device, Browser, and OS
For more information, please scroll down to the FAQ section.
Too many flawed browser, OS, and device detection algorithms. Most are a jumble of regex and if statements. Also, the quality, accuracy, and consistency can vary greatly between languages and implementations. TextGlass is an attempt at a better detection library. Code and pattern data are cleanly seperated and a specification exists so that results are identical regardless of language or platform. Also, the pattern rules allow for any unique text to be identified with a simple definition.
LINKSGithub project home
Device domain [Download]
Browser domain [Download]
OS domain [Download]
Reference client [Download]
C client [Download]
Java client [Download]
Apache License 2.0
How do you do mobile detection with TextGlass?
Classify an HTTP User-Agent string against the Browser and OS domains. Check if the "mobile" attribute is set to "true" on either domain. This method relies on the Browser and OS signatures to tell us if the requestor is on a mobile platform. This is the best method because the set of known operating systems and browsers is small, stable, and manageable.
Can you use the Device domain to do mobile detection?
Yes, classify an HTTP User-Agent string against the Device domain and check if the "mobile" attribute is set to "true". This method relies on identifying the actual device to tell us if the requestor is on a known mobile device. The downside to this method is that TextGlass can only identify devices which have been defined in the Device domain. The set of mobile devices is large and always changing.
How do you detect tablets?
Using the Device domain, check if "tablet" is set to "true".
How do you detect web crawlers, search engines, and bots?
Using the Device domain, check if "bot" is set to "true".
Is TextGlass some kind of NLP engine?
TextGlass only performs one part of a classical NLP system: named entity recognition. Each domain can be considered an independent entity index.
Can TextGlass be used as a WAF?
Absolutely. The domain specification is forward compatible with the type of advanced pattern matching functionality a WAF would require. When a security domain is used on an HTTP platform like Varnish, Nginx, or Apache, the result is a WAF.
How can I contribute?
By creating issues on the Github project pages for missing devices, browsers, and operating systems. Also, by contributing TextGlass clients for languages and platforms we do not support. Please use the reference client and the TextGlass specification for creating new clients.
Does TextGlass compete with commericial vendors?
No, we encourge 3rd parties to leverage the TextGlass ecosystem by creating their own TextGlass domains (please see the TextGlass specification). 3rd parties, open source or commercial, are free to distribute their TextGlass domains using their own licensing model, free or paid.