diff --git a/README.md b/README.md index ab44557..9638851 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,34 @@ # libstemmerd libstemmer binding for d programming language. + +## How to + +```d +import std.stdio; +import stemmer; + +void main() +{ + // Print a list of available languages + writeln("Available languages: "); + foreach(stemmer; Stemmer.list) + writeln(" - ", stemmer); + + // Create an english stemmer + Stemmer s = Stemmer("english"); + + // Try it! + assert(s.stem("testing") == "test"); + assert(s.stem("test") == "test"); + assert(s.stem("tested") == "test"); + + assert(s.stem("consist") == "consist"); + assert(s.stem("consisted") == "consist"); + assert(s.stem("consistency") == "consist"); + assert(s.stem("consistent") == "consist"); + assert(s.stem("consistently") == "consist"); + assert(s.stem("consisting") == "consist"); + assert(s.stem("consists") == "consist"); + +} +```