-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
|
||
namespace EmotionML | ||
{ | ||
[Serializable()] | ||
public class EmotionException : System.Exception | ||
{ | ||
public EmotionException() : base() { } | ||
public EmotionException(string message) : base(message) { } | ||
public EmotionException(string message, System.Exception inner) : base(message, inner) { } | ||
|
||
protected EmotionException(System.Runtime.Serialization.StreamingContext context) { } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Xml; | ||
|
||
namespace EmotionML | ||
{ | ||
class EmotionList : List<Emotion> | ||
{ | ||
/// <summary> | ||
/// emotions categories in current emotion annotation | ||
/// </summary> | ||
public EmotionSet<EmotionCategory> category = null; | ||
/// <summary> | ||
/// emotions dimensions in current emotion annotation | ||
/// </summary> | ||
public EmotionSet<EmotionDimension> dimension = null; | ||
/// <summary> | ||
/// emotions appraisals in current emotion annotation | ||
/// </summary> | ||
public EmotionSet<EmotionAppraisal> appraisal = null; | ||
/// <summary> | ||
/// emotions action tendencies in current emotion annotation | ||
/// </summary> | ||
EmotionSet<EmotionActionTendency> actionTendency = null; | ||
|
||
/// <summary> | ||
/// creates a DOM-list of emotions in list | ||
/// </summary> | ||
/// <returns>DOM of emotionml notation</returns> | ||
public XmlDocument ToDom() | ||
{ | ||
//init root node with attributes | ||
XmlDocument emotionmlXml = new XmlDocument(); | ||
XmlElement emotionml = emotionmlXml.CreateElement("emotionml"); | ||
|
||
if (this.category != null) | ||
{ | ||
emotionml.SetAttribute("category-set", this.category.getEmotionsetUri().AbsoluteUri); | ||
} | ||
if (this.dimension != null) | ||
{ | ||
emotionml.SetAttribute("dimension-set", this.dimension.getEmotionsetUri().AbsoluteUri); | ||
} | ||
if (this.appraisal != null) | ||
{ | ||
emotionml.SetAttribute("appraisal-set", this.appraisal.getEmotionsetUri().AbsoluteUri); | ||
} | ||
if (this.actionTendency != null) | ||
{ | ||
emotionml.SetAttribute("action-tendency-set", this.actionTendency.getEmotionsetUri().AbsoluteUri); | ||
} | ||
|
||
//add emotions to list | ||
for (int i = 0; i < this.Count; i++) | ||
{ | ||
XmlDocument emotion = this.ElementAt(i).ToDom(); | ||
emotionml.AppendChild(emotion); | ||
} | ||
|
||
emotionmlXml.AppendChild(emotionml); | ||
|
||
return emotionmlXml; | ||
} | ||
|
||
/// <summary> | ||
/// creates EmotionML-XML for emotion list | ||
/// </summary> | ||
/// <returns>XML of emotions</returns> | ||
public string ToXml() | ||
{ | ||
return this.ToDom().ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters