Fwew: A Better Crossplatform Na'vi Dictionary Terminal App

Started by Tirea Aean, March 30, 2015, 02:31:36 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Tirea Aean

So yeah. VrrtepCLI and the Python2 days are over. I've recently re-written that project from the ground up using the Go Programming language. The result is Fwew. This time, we have a binary for each platform, so that the user doesn't need anything additional installed in order to run the program.

Anyone want to collaborate with me on GitHub? I need someone who knows how to get it to work on Mac and Windows.
Fwew is still in BETA, so I also want people to test it out and report bugs to this thread.

More info on GitHub: https://github.com/tirea/fwew

Screenshots:


Tìtstewan

*Windows 7 user rise its hand*

I have no idea about Go language, but after a bit reading some tutos and pfd I could help a bit. :)

-| Na'vi Vocab + Audio | Na'viteri as one HTML file | FAQ | Useful Links for Beginners |-
-| Kem si fu kem rä'ä si, ke lu tìfmi. |-

Tirea Aean

Quote from: Tìtstewan on March 30, 2015, 02:35:06 PM
*Windows 7 user rise its hand*

I have no idea about Go language, but after a bit reading some tutos and pfd I could help a bit. :)

I had no idea about Go Language until creating this project. It was easy and fun. The documentation is very very good.

EDIT: Screenshots added to OP

DOUBLE EDIT: Something is causing it to fail on Reverse lookup (-r flag) I'll look into that soon.
TRIPLE EDIT: Fixed (on Linux)

Tìtstewan

Ma Tirea, could you make the source code as txt file available? I want to try if I can convert that in C# and program that with a GUI instead console commands.

-| Na'vi Vocab + Audio | Na'viteri as one HTML file | FAQ | Useful Links for Beginners |-
-| Kem si fu kem rä'ä si, ke lu tìfmi. |-

Tirea Aean

Quote from: Tìtstewan on March 30, 2015, 03:04:13 PM
Ma Tirea, could you make the source code as txt file available? I want to try if I can convert that in C# and program that with a GUI instead console commands.

The source code of course is there on the GitHub. Windows version is in the windows branch of the repository.

More screenshots added to OP. I saw that you updated the Projects Database. You can just call this project Fwew, if you want.

If you make a GUI for this, that would be awesome. You could perhaps make a nice Form gui that has buttons/switches for the cli flags. And as a bonus, one could run that program "headless" ie from the terminal with a -headless flag so it runs without GUI as shown in my screenshots.

As you see, this program was never really meant to be user-friendly for Windows users. Only Linux users and Mac Power-users will understand this program truly. I simply extended the program to allow all users of all platforms to use it.

+1 to you if you get a working GUI version running. You will EASILY be able to implement this in C#. Here is what you'll need to know how to do in C#, in no particular order:

1. FILE I/O; You want to be able to read
    C:\Users\<user>\.fwew\metaWords.txt
    and
    C:\Users\<user>\.fwew\localizedWords.txt
2. Get User input (Input Text Area?)
3. Get ID of user input (read file, match input to line, return ID#)
4. Get Translation by ID
5. Get Data by ID
6. Operation preferences (commandline flags -> buttons/switches)
7. do 1-5 according to 6

Tìtstewan

I wasn't able to run the GO environment on my macheine, yet. That's why I asked you for the (raw) code in txt.
To create a GUI isn't difficult, but the play with the buttuns will be funny. ;D

-| Na'vi Vocab + Audio | Na'viteri as one HTML file | FAQ | Useful Links for Beginners |-
-| Kem si fu kem rä'ä si, ke lu tìfmi. |-

Tirea Aean

Quote from: Tìtstewan on March 30, 2015, 11:21:30 PM
I wasn't able to run the GO environment on my macheine, yet. That's why I asked you for the (raw) code in txt.
To create a GUI isn't difficult, but the play with the buttuns will be funny. ;D

The easiest way to get my fwew running on the Go environment on Windows is... hmm... You need to search Windows for Environment Variables for your account. Then add a variable called GOPATH and set it to the location of the fwew folder you checked out from GitHub.

Then again, you don't really need to use go to run this program; you only need go to compile it from source. (This is why I put the fwew.exe binary in the bin folder for you already.) So really, all you have to do to get this program to run is, copy the .fwew folder to C:\Users\<user>\ and then use cmd to chdir to the C:\...\fwew\bin folder where fwew.exe is, and then simply run fwew.exe as found in my screenshots in OP

EDIT: The actual Go Source code is at:

C:\Users\<user>\...\fwew\src\fwew\fwew.go
C:\Users\<user>\...\fwew\src\util\txt.go

It's just those two files. fwew.go is the main one, and the txt.go is just a strings library thingy I made for it.

DOUBLE EDIT: And of course, you'll need to use these somehow:

C:\Users\<user>\.fwew\metaWords.txt
C:\Users\<user>\.fwew\localizedWords.txt

Tìtstewan

Oh, I see. I am blind. hrh.
I see the windows console have some problems to display the IPA. xD
Hmm...
-i = ?
-ipa = IPA
-r = ?
-l=<language> = language code (that could be a nice dropdown menu)

-| Na'vi Vocab + Audio | Na'viteri as one HTML file | FAQ | Useful Links for Beginners |-
-| Kem si fu kem rä'ä si, ke lu tìfmi. |-

Tirea Aean

Quote from: Tìtstewan on March 30, 2015, 11:40:54 PM
Oh, I see. I am blind. hrh.
I see the windows console have some problems to display the IPA. xD
Hmm...
-i = ?
-ipa = IPA
-r = ?
-l=<language> = language code (that could be a nice dropdown menu)


The flags are explained on GitHub at the README.md and also, if you run the program fwew.exe -h or fwew.exe -help :)

EDIT: Okay, here is how the flags work, in detail, since this isn't really explained anywhere except screenshots and the README.

-i is a BOOL flag; false by default, true if -i OR -i=true is present on command line. This is responsible for displaying INFIX location data.

-l is a STRING flag; txt.Text("DEFAULT_LANGUAGE") by default (which is "eng"), you can set the language to whatever comes after it, like this:
-l de  // this sets the language to Deutsch. which means lookup answers will be auf Deutsch.
-l=de // this is the same exact thing as the above.
-l="de" // same thing again.

-r is a BOOL flag; false by default, true if -r OR -r=true is present on command line. This REVERSES the lookup direction. Default lookup direction is Na'vi input -> Local-language output

and as you guessed, -ipa OR -ipa=true displays the IPA. Which is not very well supported on the Windows command line output, apparently.

----

OH! Hey Tìtstewan

Speaking of a GUI Desktop dictionary for Na'vi on Windows, remember THIS?:

http://forum.learnnavi.org/projects/learn-navi-desktop-dictionary/

I found a copy on my old hard drive, and I have manually updated the XML dictionary for it. :D I can post the program on the forums again with this updated dictionary somewhere if there's interest. But the Linux / Mac version is lost forever.

EDIT:
Quote from: Tirea Aean on December 25, 2014, 09:38:42 AMThe EDITS! ;D

Tìtstewan

That thread is before my time, but super interesting. :)
But I thought, if I write a new one, I could give you the source code and you could compile it (after modification) for Mac and Linux platforms (and technically, theoretically also for Android/WinPhone)?
Also, you don't want to add also the little games you have in Vrrtep CLI?


HRH.png!
The edits! ;D

-| Na'vi Vocab + Audio | Na'viteri as one HTML file | FAQ | Useful Links for Beginners |-
-| Kem si fu kem rä'ä si, ke lu tìfmi. |-

Tirea Aean

Quote from: Tìtstewan on March 30, 2015, 11:52:59 PM
That thread is before my time, but super interesting. :)
:D I used to use that program, before skxawng.lu died (which means so did its updates)

QuoteBut I thought, if I write a new one, I could give you the source code and you could compile it (after modification) for Mac and Linux platforms (and technically, theoretically also for Android/WinPhone)?
If you write C# code, it will likely be really Windows-specific. For Linux, I'd probably have to figure out what Go likes to use for GUIs. For Mac... I have no idea at all. I just know what the general package / program structure is on each of these OSs.

EDIT: Hopefully, I will find out that Go has a nice cross-platform GUI option. In which case that'd be totally awesome. only a wish at this point. I still have to Google this. I still to this day have never created an app that has a GUI except for something that runs on the Web using HTML+CSS/PHP/JavaScript

As for Android, its GUIs are defined by XML layouts. I could easily write Java code of this Go program and translate your UI to an Android UI and make an app. But then I must think of how it would differ from the Learn Na'vi Android app. And I have 0 idea about Windows Phone whatsoever. :-[

QuoteAlso, you don't want to add also the little games you have in Vrrtep CLI?

I could, but.. did anyone actually use those?

Tìtstewan

I am at work now with limited network...
I find interetsing stuff about GO-lang and GUI, and unfortunately, there isn't much useful stuff.
Alternative options I am thinking to use is C, C++ , Java or Python. :-\ What if I write it in C# and one "translate" the source code in a Linux and MacOS one?

Ma Tirea, it would be really useful to create a program with an user interface. There are not so many people who are masters in using console commands.

-| Na'vi Vocab + Audio | Na'viteri as one HTML file | FAQ | Useful Links for Beginners |-
-| Kem si fu kem rä'ä si, ke lu tìfmi. |-

Tìtstewan

Double post!

Ma Tirea, I played a bit with Visual Basic...

Btw, I downloaded the lasted Visual Basic (2013) and it supports now also Python that one can compile stuff for Linux and MacOS too, if I am not mistaken. ;)

The programming part is a blackhole at the moment. :S

-| Na'vi Vocab + Audio | Na'viteri as one HTML file | FAQ | Useful Links for Beginners |-
-| Kem si fu kem rä'ä si, ke lu tìfmi. |-

Blue Elf

After a few initial problems I was able to download it and run, buuuuuut:
- how to get data files? It is possible to get them from vrrtepcli?
- is there possibility of data update form the web as in vrrtepcli?

As for GUI - I don't think it is necessary, I love cmdline tools (well, Windows are not so good on cmdline as Linux, but if you are experienced enough, you still can do magic even on Windows in command prompt).
IMHO in .Net should be possible to create crossplatfom application - at least for Win and Linux (via Mono - if it is not dead. I don't know how about Mac)
Oe lu skxawng skxakep. Slä oe nerume mi.
"Oe tasyätxaw ulte koren za'u oehu" (Limonádový Joe)


Tirea Aean

#14
Quote from: Blue Elf on April 03, 2015, 02:18:28 PM
After a few initial problems I was able to download it and run, buuuuuut:

Did you run the ./install.sh script? It copies the datafiles for you. The data files are in .fwew/ which is a hidden folder in your file browser because its name starts with dot.

Quote- how to get data files? It is possible to get them from vrrtepcli?
~/.vrrtepcli/metaWords.txt  ==> ~/.fwew/metaWords.txt
~/.vrrtepcli/localizedWords.txt ==> ~/.fwew/localizedWords.txt

Quote- is there possibility of data update form the web as in vrrtepcli?
Not right now, updates must be manual:
cd ~/.fwew
wget http://tirea.learnnavi.org/dictionarydata/localizedWords.txt
wget http://tirea.learnnavi.org/dictionarydata/metaWords.txt
cd


Quote from: Tìtstewan on March 31, 2015, 01:29:48 AM
I am at work now with limited network...
I find interetsing stuff about GO-lang and GUI, and unfortunately, there isn't much useful stuff.
I still haven't looked yet.

QuoteAlternative options I am thinking to use is C, C++ , Java or Python. :-\
If you write it in python, you might as well use vrrtepcli project and add a GUI. :-\

QuoteWhat if I write it in C# and one "translate" the source code in a Linux and MacOS one?
It would be easy enough to get a simple C# program to run in Windows (obviously) and Linux using mono. Mac I don't know about. It's probably possible..... with a purchased program.

QuoteMa Tirea, it would be really useful to create a program with an user interface. There are not so many people who are masters in using console commands.
QuoteAs for GUI - I don't think it is necessary, I love cmdline tools
Me too :D

Quote(well, Windows are not so good on cmdline as Linux, but if you are experienced enough, you still can do magic even on Windows in command prompt).
This. Windows users generally have no idea about the CMD.exe so a GUI program makes absolute total sense for windows users. Probably even Mac too. I feel like Linux users are the only crowd who religously use the commandline / terminal emulator

QuoteIMHO in .Net should be possible to create crossplatfom application - at least for Win and Linux (via Mono - if it is not dead. I don't know how about Mac)
Right. Mono is not dead and it works for moderately simple programs written in C#. I'll have to test on a Mac. I would imagine that mono may have been compiled to run on Mac.

So here is what I want to do with GUIs... Let's try make a GUI version of this, cross-platform, so that it can run with OR without the GUI. In the simplest and most efficient possible way.


EDIT: I've searched GUI Toolkit bindings for Go and found this:

Quote from: http://blog.golang.org/a-conversation-with-the-go-teamThere are many bindings for existing graphics libraries out there, and a few Go-specific projects. One of the more promising ones is go.uik, but it's still in its early days. I think there's a lot of potential for a great Go-specific UI toolkit for writing native applications (consider handling user events by receiving from a channel), but developing a production-quality package is a significant undertaking. I have no doubt one will come in time.

In the meantime, the web is the most broadly available platform for user interfaces. Go provides great support for building web apps, albeit only on the back end.

So a new Web App it is..? :D (I'm actually okay at writing WEB UIs. I have 0 exp writing native Desktop App UI)

Wllìm

Quote from: Tirea Aean on April 04, 2015, 10:22:28 AM
Quote from: http://blog.golang.org/a-conversation-with-the-go-teamIn the meantime, the web is the most broadly available platform for user interfaces. Go provides great support for building web apps, albeit only on the back end.

So a new Web App it is..? :D (I'm actually okay at writing WEB UIs. I have 0 exp writing native Desktop App UI)
I think a web app for search would be nice, but we already have dict-navi.com, right? So what would distinguish Fwew from this? :-\

By the way, I really like the idea of a web app that does more than what dict-navi.com currently does. For example, determination of words, searching for example sentences for words, sentence parsing or even sentence translation... Okay, now I'm just spawning random ideas ;D

I like writing web apps, but I have basically zero experience with Go... (Usually I use Python/Django :D) So I can certainly help with the front-end (JavaScript or such), and I can try learning some Go and work on the back-end. I should also be able to host the app on my server if that is needed...

Tirea Aean

#16
Yeah.... That's the thing. I also thought about this.

If Fwew had a GUI, how would it be different or better than Dict-Na'vi? Dict-Na'vi is still the best dictionary for Na'vi available on all platforms with a browser.

Dict-Na'vi already lists the source for each word. Search a word and notice the link to its original source. But not every word gets an example sentence.

One day, I want to make a new database or new table for an existing database for example sentences that has a similar structore to metaWords and localizedWords:


Ex_ID   | Ex_Sent-Nav | Ex_IPA         | Ex_Link
0       | Tsun tivam  | [tsun tivam]   | http://link.to/the/original/post
...

Ex_ID | Lang_Code          | Ex_Local                                             | Ex_Link
0     | en                 | That'll do; that's okay; okay; that will suffice     | http://link.to/the/original/post
0     | de                 | Das kann ausreichen.                                 | http://link.to/the/original/post
...



Okay so I don't know. But I do know that to use Fwew, more people would be comfy with a GUI. For the rest of us, it'll do as-is.

Fwew /will/ eventually have a Parser. Which if done properly, Na'vi needs to have its first official BNF-style grammar drawn up. Who wants to help me tackle this? :D

EDIT: If we can't make a parser in the same way ones are made for programming languages, maybe we can draft a Finite State machine based on the Na'vi gramamar. Though insane, this may be the "easier" way to know if a sentence is a valid Na'vi sentence or not.

Wllìm

It would indeed be nice to have such a database of sentences :)

Quote from: Tirea Aean on April 04, 2015, 11:40:08 AM
Fwew /will/ eventually have a Parser. Which if done properly, Na'vi needs to have its first official BNF-style grammar drawn up. Who wants to help me tackle this? :D

EDIT: If we can't make a parser in the same way ones are made for programming languages, maybe we can draft a Finite State machine based on the Na'vi gramamar. Though insane, this may be the "easier" way to know if a sentence is a valid Na'vi sentence or not.

Yes, from my limited experience in natural-language parsing (once did a project related to it, not really more than that ;)), I think a BNF grammar is not going to work, since such rigid grammars don't work for natural languages. Furthermore BNF has problems with flexible word order - I think the only way to tackle that is to just add all possible word orders to the grammar, which is not really nice...

I've been looking at something called chart parsing once; that could give a more flexible parser. However I am not at all sure how that would work. I know that NLTK has a chart parser built in, so that could be interesting to look at.

We will also need a good lexer that gives all possible derivations of a word (so for example for input tewti it should give something like [txew (noun) + short plural + patientive, tewti (adj)])...

Can you explain a bit more what you mean by a finite state machine based on the grammar? As far as I know (but that could be wrong :P) finite state machines are less powerful than BNF parsers... :(

By the way, if we have a parser, creating a basic Na'vi-to-English translator (that actually understands the grammar, so not like the Na'vilator) would become much easier as well ;D

I'm very interested in this, though, so count me in :D

Tìtstewan

Tirea, what about adding such a toy on your website? :)

Quote from: Wllìm on April 04, 2015, 12:25:29 PM
It would indeed be nice to have such a database of sentences :)
Isn't Plumps' dictionary such a "database"? It has a lot of example sentences.
And btw, I would really like to see an EanaEltu 2.0 that use/generate Plumps dictionary version. :)

-| Na'vi Vocab + Audio | Na'viteri as one HTML file | FAQ | Useful Links for Beginners |-
-| Kem si fu kem rä'ä si, ke lu tìfmi. |-

Blue Elf

Quote from: Tirea Aean on April 04, 2015, 10:22:28 AM
Quote from: Blue Elf on April 03, 2015, 02:18:28 PM
After a few initial problems I was able to download it and run, buuuuuut:

Did you run the ./install.sh script? It copies the datafiles for you. The data files are in .fwew/ which is a hidden folder in your file browser because its name starts with dot.
No. I'm Windows user

Quote
Quote- how to get data files? It is possible to get them from vrrtepcli?
~/.vrrtepcli/metaWords.txt  ==> ~/.fwew/metaWords.txt
~/.vrrtepcli/localizedWords.txt ==> ~/.fwew/localizedWords.txt
I already found it and it works :)

Quote
Quote- is there possibility of data update form the web as in vrrtepcli?
Not right now, updates must be manual:
cd ~/.fwew
wget http://tirea.learnnavi.org/dictionarydata/localizedWords.txt
wget http://tirea.learnnavi.org/dictionarydata/metaWords.txt
cd

That's ok for me - simple .cmd file can do that
Oe lu skxawng skxakep. Slä oe nerume mi.
"Oe tasyätxaw ulte koren za'u oehu" (Limonádový Joe)