How to generate sequence of nodes for synonyms
I am trying to create an interactive thesaurus visualisation,
i'm not brilliant at scripting but i can understand more than i can produce - and have used unity before but I'm not sure how to - or even if it is possible to - connect a database of synonyms (such as WordNet which I have) to a node based system in unity.
I would start with the user inputting a word of their choice, this word is checked against the database and then the synonyms are displayed. it would work as node based tree, the words you click on instigate more words/nodes etc (in 3d space) - (Example image of visual, node based synonym chart)
thanks for any help/pointers in the right direction
Answer by NoseKills · Jul 29, 2016 at 03:33 PM
using System.Collections.Generic;
public class WordNode {
public string Word { private set; get; }
public List<WordNode> synonyms;
public WordNode(string word) {
Word = word;
synonyms = new List<WordNode>();
}
}
public class SynonymApp {
public Dictionary<string, WordNode> dict;
public void Init() {
var words = new string[4];
words[0] = "strong";
words[1] = "powerful";
words[2] = "rock";
words[3] = "stone";
dict = new Dictionary<string, WordNode>();
foreach (var w in words) {
dict.Add(w, new WordNode(w));
}
dict["strong"].synonyms.Add(dict["powerful"]);
dict["rock"].synonyms.Add(dict["stone"]);
}
}
That's a simple example. How you populate the data is another thing.