Skip to content
Tamgu (탐구), a FIL programming language: Functional, Imperative, Logical all in one for annotation and data augmentation
C++ C Python Objective-C Makefile HTML Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Xcode update code Jul 9, 2019
allmaps First commit Jul 8, 2019
bnf First commit Jul 8, 2019
docs Update blog_fr.md Aug 20, 2019
examples update examples Jul 11, 2019
include Update jag.h Aug 20, 2019
java First commit Jul 8, 2019
libcurl First commit Jul 8, 2019
liblinear First commit Jul 8, 2019
libpython
libs/windows First commit Jul 8, 2019
libsqlite First commit Jul 8, 2019
libtamgu First commit Jul 8, 2019
libwapiti First commit Jul 8, 2019
libword2vec
libxml First commit Jul 8, 2019
src Bug and corrections Aug 19, 2019
tamgucom First commit Jul 8, 2019
tamguconsole First commit Jul 8, 2019
tamgudll First commit Jul 8, 2019
tamgui First commit Jul 8, 2019
tamguinstaller First commit Jul 8, 2019
template First commit Jul 8, 2019
.gitignore Two minor updates Jul 22, 2019
LICENSE First commit Jul 8, 2019
Makefile First commit Jul 8, 2019
NOTICE First commit Jul 8, 2019
README.md Update README.md Aug 20, 2019
Tamgu_license.txt First commit Jul 8, 2019
install.py update for python 2 Jul 11, 2019
tamgu.sln Update tamgu.sln Jul 11, 2019
tamguraw.sln First commit Jul 8, 2019

README.md

TAMGU (탐구): A FIL Language

TAMGU is a FIL programming language: Functional, Imperative and Logical.

TAMGU is a multithreaded programming language that provides:

  • an imperative formalism close to Python, but with a strong and powerful type system.
  • a functional formalism inspired by Haskell, which can freely mix with the imperative paradigm
  • a logical formalism inspired by Prolog, which can freely mix with the imperative and functional paradigms

For each specific problem in your programming, choose the most appropriate formalism and freely mix functional, imperative and logical approaches to implement the most expressive but also the most compact code possible.

Annotation

TAMGU provides also an annotation language implementation (see below for an example), which allows for an efficient way to detect complex patterns in text.

The language provides many features but also many libraries, which helps design and implement annotation schemes for complex documents.

Code Example

Below is an example of the kind of code that you can implement with Tamgu.

//An imperative language

int i=10;
string s="20";
------------------------------------------------------------------------------------
//Containers

map m = {'a':1, 'b':2}; //all sorts of containers
treemap t = {"u":10, 'v':'toto'};
vector v = [1,2,3,"a","b"];
ivector iv = [1..10]; //iv = [1,2,3,4,5,6,7,8,9,10]
iv = [1,3..10]; //iv = [1,3,5,9]
------------------------------------------------------------------------------------
//Functions, threads and frames

function mycall(int i, string s) {...} //functions
thread mythread(int i, string s) {...} //threads
frame myclass {...} //class definition
------------------------------------------------------------------------------------
//Native Korean string support

s="에버랜드 알쏭달쏭 Quiz";
if (s[0].ishangul()) println("Ok");
uvector dec = s.jamo(); //['ᄋ','ᅦ','ᄇ','ᅥ','ᄅ','ᅢ','ᆫ','ᄃ','ᅳ'...]
dec = s.romanization(); //['-/ng','e','b','eo','r/l','ae','n','d',...]
------------------------------------------------------------------------------------
//Functional approach based on Haskell

ivector iv = [1..20]; //a list of integers between 1 and 20
iv.shuffle(); //The order of the elements is now random.

<fastsort([]) = []>;  //if the list is empty, we return an empty "list"
<fastsort([fv:v]) =  minlist &&& fv &&& maxlist where //we merge the different list...
    let minlist = fastsort(<filter (<=fv) v>), //we sort the list with elements smaller than fv
    let maxlist = fastsort(<filter (>fv) v>)>; //we sort the list with elements larger than fv

//we can call a functional definition as regular code
v=fastsort(iv); 

------------------------------------------------------------------------------------
//Predicates

concat([],?X,?X).
concat([?H|?T],?Y, [?H|?Z]) :- concat(?T,?Y,?Z).

//You can mix freely your predicate definition with some regular tamgu code
v=concat(["english",'russian',"french"],['spanish'],?L);
println(v); //["english",'russian',"french","spanish"]

Annotation Example

Tamgu also provides an integrated rule mechanism, which combines both lexicons and rules to detect complex patterns in texts.

//We define some lexical rules (starting with a "@")
@food <- burger.
@food <- tartare.


//Our rule: if "the food" word is found in a sentence, then we return a "meal" label 
meal <- "the", #food.

//We need a specific object to scan a sentence
annotator r;

//a sentence
string sentence="Here, the burger and the tartare are delicious."
vector v = r.parse(sentence); 

//Result: v =  [['meal',[10,16]],['meal',[25,32]]]
//It reads: two 'meal' were found at position 10-16 and position 25-32...

Pre-compiled Releases

Note: Releases for Windows, Mac OS and Linux are available at: https://github.com/naver/tamgu/releases

Documentation

The documentation is in : docs/tamgu.pdf

Examples

Examples are available both as a folder: https://github.com/naver/tamgu/tree/master/examples or as an archive in: https://github.com/naver/tamgu/releases/tag/tamgu.examples.

Compiling

The TAMGU project has been implemented in C++. It can be compiled on most platforms:

Libraries

Tamgu also provides different libraries:

Compiling libraries: https://github.com/naver/tamgu/wiki/1.4-Compiling-libraries-(Linux-&-Mac-OS)

Python

Furthermore, Tamgu provides a bi-directional library, which can be used to execute Tamgu code from Python (and conversely, Python code in Tamgu)

See: https://github.com/naver/tamgu/wiki/1.5-Compiling-Python for more information

License

BSD 3-Clause License

Copyright (c) 2019-present NAVER Corp.
All rights reserved.

Redistribution and use in source and binary forms, with or without 
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this 
   list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, 
   this list of conditions and the following disclaimer in the documentation 
   and/or other materials provided with the distribution.

3. Neither the name of Naver Corporation nor the names of its 
   contributors may be used to endorse or promote products derived from 
   this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You can’t perform that action at this time.