nixon-voxell / UnityNLP

Natural Language Processing in Unity.
https://unitynlp.readthedocs.io/
Apache License 2.0
62 stars 6 forks source link

WordNet Synsets Error #2

Open playfulsystems opened 2 years ago

playfulsystems commented 2 years ago

I'm trying to use WordNet with the WordnetDictionary class. It seems to have problems identifying synsets. I think this is the simplest example to reproduce it, since the GetParentSenseKeys function uses GetSynsets(). It's getting caught up in CreateSynset() in DataFileEngine.cs. The record variable (line 260) seems off. Here's my code:

image

nixon-voxell commented 2 years ago

Hey thank you for the issue report! I will take a look over this weekend.

nixon-voxell commented 2 years ago

hi there, I haven't really dug into the issue yet, may I request a more detailed version of your code snippet? thank you! (please copy and paste haha it is quite tedious to retype from screen shots)

playfulsystems commented 2 years ago

Thanks for following up. Ultimately, I just want to get at Hypernerms and Hyponyms from a synset. I tried to simplify it as much as possible, so this is the minimal amount of code to produce the error on my side. I added this WordNetDefinition script to an empty game object. When I press the Get Definition button, it gives me an error. I have the wordNetFolder property set to "StreamingAssets/WordNet/dict"

It's possible I haven't set it up correctly. Do you get a NullReferenceException w/this script?

using SharpWordNet;
using UnityEngine;
using Voxell;
using Voxell.Inspector;
using Voxell.NLP.Coreference.Mention;

public class WordNetDefinition : MonoBehaviour
{
    [StreamingAssetFolderPath] public string wordNetFolder;
    WordnetDictionary dict;
    public string searchWord;

    private void Start()
    {
        dict = new WordnetDictionary(FileUtilx.GetStreamingAssetFilePath(wordNetFolder));
    }

    [Button]
    public void GetDefinition()
    {
        string[] parentSenseKeys = dict.GetParentSenseKeys("car", "noun", 0);
    }
}
nixon-voxell commented 2 years ago

hi, may I know where you got the wordNetFolder?

playfulsystems commented 2 years ago

In the inspector, I set the wordNetFolder property to "StreamingAssets/WordNet/dict" that was provided in the project. I used the folder icon to navigate to that location.