Skip to content

gfobe/EmotionML-Lib-CSharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Library to parse and create EmotionML with C#.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages