Library to parse and create EmotionML with C#.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Properties
dll
doc
resources
.gitignore
ActionTendency.cs
Appraisal.cs
Category.cs
Dimension.cs
Emotion.cs
EmotionML.cs
EmotionML.csproj
EmotionML.sln
EmotionMLException.cs
EmotionmlDocument.cs
Helper.cs
HelperCache.cs
HelperMimetype.cs
HelperVocabularycheck.cs
Info.cs
Item.cs
Parser.cs
Part.cs
README.rst
Reference.cs
Set.cs
Trace.cs
Vocabulary.cs

README.rst

EmotionML library for C#

With the help of this library you can parse and create EmotionML with C#. Both, EmotionML documents and fragments, are supported. Furthermore you can work with the represented emotions a little bit.

You can download this library in a compiled format.

Using of this library

Parsing of EmotionML

You can parse a whole EmotionML document or only parts of it with the build in EmotionML parser.

Load by XmlDocument:

XmlDocument emotionmlDoc = new XmlDocument();
emotionmlDoc.Load("your.emotionml");
Parser emotionmlParser = new Parser(emotionmlDoc);

Load by string:

Parser emotionmlParser = new Parser(emotionmlString);

After that you can access the parts of EmotionML document you need.

Whole EmotionML document:

EmotionMLDocument emotionmlDoc = emotionmlParser.getEmotionMLDocument();

List of emotions:

List<Emotion> emotionList = emotionmlParser.getEmotions();

Single emotion:

Emotion emotion = emotionmlParser.getSingleEmotion();

List of vocabularies:

List<Vocabulary> vocabularyList = emotionmlParser.getVocabularies();

Single vocabulary:

Vocabulary vocabulary = emotionmlParser.getSingleVocabulary();

Creating EmotionML

You can create XmlDocument instances with the method ToDom() and XML with the method ToXml().

Add some emotions to an EmotionML document and output it as XML:

EmotionMLDocument emodoc = new EmotionMLDocument();
emodoc.addEmotion(emotion1);
emodoc.addEmotion(emotion2);

Console.Write(emodoc.ToXml());

Output single emotion as XmlDocument:

emotion1.ToDom();

Internal structures

In general every XML tag has it's own class. Furthermore there is a directory resources with some XSLT for validation and a file with the default vocabularies of EmotionML. This files are accessible via Helper::loadInternalResource(). However, here is a simplified class diagram:

https://raw.github.com/gfobe/EmotionML-Lib-CSharp/12c371608a52035d0195ec45310c16cb0d91530b/doc/class-diagramm-EmotionML-lib_easy.png

Next steps

  • integration of automated tests
  • references between emotions and vocabularies
  • improvements in comparisons

Other things

License: FreeBSD