且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何为多语言字典创建数据库?

更新时间:2023-01-22 11:36:58

I可能会有一个表格用于每种语言。

我会有一个多对多的链接表,所以你可以链接语言之间的单词。

我会有一个链接类型表定义类型 - 直接,反义词,同义词等。

您可以考虑链接上的权重,而不是衡量连接的准确性。否定=反义词,正=同义词,零是直接链接。



以上是一个非常简单和僵化的设计,应该有更灵活的方法来做类似的事情此

If you have ever downloaded "pleco", that is what i want to program. But, i want to make a multi language version. I want to add Japanese and Korean. I want the same features like the dictionary tab, have it divide the characters to show individual meanings, words that contain that character, and example sentences. I also want to add a synonym and antonym tab.

But I don't know how to go about making the database to store every character and synonyms, sentences, etc.

What I have tried:

I have searched online and came across this type of dictionary:

----------------------------------------------------------------------

class StudentName
{
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public int ID { get; set; }
}

class CollInit
{
    Dictionary<int, StudentName> students = new Dictionary<int, StudentName>()
    {
        { 111, new StudentName {FirstName="Sachin", LastName="Karnik", ID=211}},
        { 112, new StudentName {FirstName="Dina", LastName="Salimzianova", ID=317}},
        { 113, new StudentName {FirstName="Andy", LastName="Ruth", ID=198}}
    };
}


----------------------------------------------------------------------------------

however, this doesn't seem to fit my need for matching language word translations, sentences, etc.

Any suggestions on how to organize this type of data base? show me visual example please.

(This is going to be programmed for android)

I would probably have a table for each language.
I would then have a many to many link table so you can link words between languages.
I would have a link type table to define the types - direct, antonym, synonym etc.
You might consider a weightage on the link instead to gauge the accuracy of the connection. Negative = antonym, positive = synonym, zero is a direct link.

The above is a very simplistic and rigid design, there should be more flexibly methods of doing something like this.