I have finished writing a .NET client library for Tagyu's REST Web-Service. Tagyu is a hosted service that uses human intelligence to suggest tags and categories relevant to a block of text.
TagyuLib (that’s my creative name for the .NET API) supports everything that the REST API of Tagyu allows you to do as of now. So it supports both classification queries and related-tags queries. It also allows you to pass your username/password to Tagyu through HTTP basic authentication scheme. If you're wondering what am I talking about here, you should really be reading Tagyu REST web service documentation first.
I have created a project at GotDotNet CodeGallery to share the source code of TagyuLib and it would be great to see people participate.
I hope some people would find TagyuLib useful and I would love to hear from them. But right now it is 2:15 AM and I need to get some sleep.
Update on March 25, 2006
Here is the class diagram and some sample code to get you started.
Class Diagram
Sample Code
Determining tags and category
You need to instantiate a new TagyuService object and simply call its GetClassification method passing-in your text. GetClassification will return you a ClassificationSuggestion object and you can loop through the items in its Tags property to do whatever you want. You can also get the category for your text from the Category property of the ClassificationSuggestion object that you got back.
string inputText = Console.ReadLine();
TagyuService ts = new TagyuService();
ClassificationSuggestion s = ts.GetClassification(inputText);
Console.WriteLine("Suggested Tags are: ");
foreach (Tag tg in s.Tags) {
Console.WriteLine(tg.Value);
}
Console.WriteLine("Suggested Category is: {0}", s.Category);
Determing related tags
That's equally simple. All you need to do is instantiate a new TagyuService object and call its GetRelatedTags method passing in the tag for which you wish to see related tags. GetRelatedTags returns a RelatedSuggestion object and you can loop through the items in its Tags property.
Console.WriteLine("Enter a Tag");
string inputTag = Console.ReadLine();
TagyuService ts = new TagyuService();
RelatedSuggestion r = ts.GetRelatedTags(inputTag);
Console.WriteLine("Related tags are: ");
foreach (Tag tg in r.Tags) {
Console.WriteLine(tg.Value);
}
Using your Tagyu username and password
As of now, unregistered users can make one request per minute from a single IP address to Tagyu and requests beyond this limit result in an error. So if this bothers you, you should create an account at Tagyu. You can pass your username and password to Tagyu through TagyuLib simply by setting these properties on the TagyuService object before invoking GetClassification and GetRelatedTags methods. Here's how:
string inputText = Console.ReadLine();
TagyuService ts = new TagyuService();
ts.Username = "[YOUR-USERNAME]";
ts.Password = "[YOUR-PASSWORD]";
ClassificationSuggestion s = ts.GetClassification(inputText);
Console.WriteLine("Suggested Tags are: ");
foreach (Tag tg in s.Tags) {
Console.WriteLine(tg.Value);
}
Console.WriteLine("Suggested Category is: {0}", s.Category);
Download
This way please!Requirements
- Microsoft .NET Framework version 2.0.50727 redistributable
- Visual Studio 2005 (if you wish to build the source-code on your machine without any tinkering)
Bugs/Issues/Feedback
I'd love to hear from people who've used TagyuLib. Please share your feedback, issues and any bugs you encounter here.Contributing
Join the project and get started.Changelog
- March 25, 2006
- Initial version
- April 02, 2006
- Merged SuggestedTag and RelatedTag classes into one.
- Renamed Suggestions to ClassificationSuggestion.
- Renamed Related to RelatedSuggestion.
- Added an overload for GetRelatedTags that takes a Tag object as argument.
- Merged SuggestedTag and RelatedTag classes into one.