Skip to content

Instantly share code, notes, and snippets.

@torash
Last active June 18, 2016 04:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save torash/d17709aca00d53c20d4a82c61ca28f03 to your computer and use it in GitHub Desktop.
Save torash/d17709aca00d53c20d4a82c61ca28f03 to your computer and use it in GitHub Desktop.
jubarecommender example (programming language)
# -*- coding: utf-8 -*-
from jubatus.recommender import client
from jubatus.recommender import types
from jubatus.common import Datum
import sys
def print_result(key, score_list):
print('{} is similar to:'.format(key))
for i, row in enumerate(score_list):
print('{:>3} {:<10} ({})'.format(i+1, row.id, row.score))
if __name__ == '__main__':
param = sys.argv
if len(param) < 3:
quit()
recommender = client.Recommender('127.0.0.1', 9199, 'sample')
result = recommender.similar_row_from_id(str(param[1]), int(param[2]))
print_result(param[1], result)
{
"method": "inverted_index",
"converter": {
"string_filter_types": {},
"string_filter_rules": [],
"num_filter_types": {},
"num_filter_rules": [],
"string_types": {},
"string_rules": [
{"key": "*", "type": "space", "sample_weight": "bin", "global_weight": "bin"}
],
"num_types": {},
"num_rules": []
},
"parameter": {}
}
Language Intended use Imperative Object-oriented Functional Procedural Generic Reflective Event-driven Other paradigm(s) Standardized?
ActionScript 3.0 Application client-side web Yes Yes Yes 1996 ECMA
Ada Application embedded realtime system Yes Yes Yes Yes concurrent distributed 1983 2005 2012 ANSI ISO GOST 27831-88
Aldor Highly domain-specific symbolic computing Yes Yes Yes No
ALGOL 58 Application Yes No
ALGOL 60 Application Yes 1960 IFIP WG 2.1 ISO
ALGOL 68 Application Yes concurrent 1968 IFIP WG 2.1 GOST 27974-88
Ateji PX Parallel application Yes pi calculus No
APL Application data processing array-oriented tacit 1989 ISO
Assembly language General Yes any syntax is usually highly specific related to the target processor No
AutoHotkey GUI automation (macros) highly domain-specific Yes No
AutoIt GUI automation (macros) highly domain-specific Yes Yes Yes No
Bash Shell scripting Yes Yes
BASIC Application education Yes Yes 1983 ANSI ISO
BBj Application business web Yes Yes No
BeanShell Application scripting Yes Yes Yes Yes In progress JCP
BitC System Yes Yes No
BLISS System Yes No
BlitzMax Application game Yes Yes Yes No
Blue Education Yes Yes Yes No
Boo Application No
Bro domain-specific application Yes Yes No
C Application system general purpose low-level operations Yes Yes 1989 ANSI C89 ISO C90 ISO C99 ISO C11
C++ Application system Yes Yes Yes Yes Yes 1998 ISO/IEC 1998 ISO/IEC 2003 ISO/IEC 2011
C# Application RAD business client-side general server-side web Yes Yes Yes Yes Yes Yes Yes structured concurrent 2000 ECMA ISO
Clarion General business web Yes Yes Yes Unknown
Clean General Yes Yes No
Clojure General Yes concurrent No
CLU General Yes Yes Yes Yes No
COBOL Application business Yes Yes Yes ANSI X3.23 1968 1974 1985; ISO/IEC 1989:1985 2002 2014
Cobra Application business general web Yes Yes Yes Yes Yes No
ColdFusion (CFML) Web Yes Yes No
Common Lisp General Yes Yes Yes Yes Yes Yes Yes extensible syntax syntactic macros multiple dispatch 1994 ANSI
COMAL 80 Education Yes Yes No
Crystal Education Yes Yes Yes Yes alpha stage No
Cython Application general numerical computing Yes Yes Yes Yes aspect-oriented No
D Application system Yes Yes Yes Yes Yes Yes generative concurrent No
Dart Application web server-side mobile IoT Yes Yes Yes structured Ecma-408 standard
Dylan Application Yes Yes No
Eiffel General application business client-side server-side web (EWF) Yes Yes Yes Yes Yes Erl-G Yes Agents distributed SCOOP Void-safe 2005 ECMA ISO
Elixir Application distributed Yes concurrent distributed No
Erlang Application distributed Yes concurrent distributed No
Euphoria Application Yes Yes No
Factor stack-oriented No
Falcon General application Yes Yes Yes prototype OOP message oriented tabular programming No
FP Yes No
F# Application Yes Yes Yes Yes No
Forth General Yes can be viewed as stack-oriented 1994 ANSI
Fortran Application numerical computing Yes Yes Yes Yes 1966 ANSI 66 ANSI 77 MIL-STD-1753 ISO 90 ISO 95 ISO 2003 ISO/IEC 1539-1:2010 (2008)
FreeBASIC Application numerical computing Yes Yes Yes Yes No
G2 Application inference expert system Yes Yes Yes common graphical development and runtime environment No
Gambas Application Yes Yes Yes No
Game Maker Language Application games Yes Yes Yes No
GLBasic Application games Yes Yes Yes simple object-oriented No
Go Application web server-side Yes Yes Yes Yes Yes concurrent No
Gosu Application general scripting web Yes Yes Yes Yes No
GraphTalk Application Yes logic No
Groovy Application general scripting web Yes Yes Yes aspect-oriented In progress JCP
Harbour Application business data processing general web Yes Yes Yes Yes Yes Yes declarative No
Haskell Application Yes Yes lazy evaluation 2010 Haskell 2010
Haxe Application general web Yes Yes Yes Yes Yes No
HyperNext Application education Yes Yes weakly typed No
HyperTalk Application RAD general Yes Yes weakly typed Unknown
Io Application host-driven scripting Yes Yes No
ISLISP General Yes Yes Yes Yes 1997 ISO
J Data processing array-oriented function-level tacit No
JADE Application distributed Yes Yes No
Java Application business client-side general mobile development server-side web Yes Yes Yes Yes Yes Yes concurrent De facto standard via Java Language Specification
Julia General technical computing Yes Yes Yes Yes Yes Yes multiple dispatch meta scalar and array-oriented parallel concurrent distributed (cloud) No
JavaScript Client-side server-side web Yes Yes Yes Yes prototype-based 1997 ECMA
Joy Research Yes stack-oriented No
K Data processing business array-oriented tacit Unknown
Kotlin Application mobile development server-side client-side web Yes Yes Yes Yes Yes No
LabVIEW (G) Application industrial instrumentation-automation Yes Yes Yes Yes dataflow visual No
Lisp General Yes Unknown
LiveCode Application RAD general Yes Yes weakly typed No
Logtalk Artificial intelligence application Yes Yes Yes logic No
Lua Application embedded scripting Yes Yes Yes Yes Yes aspect-oriented No
Maple Symbolic computation numerical computing Yes Yes Yes Yes distributed No
Mathematica Symbolic language Yes Yes Yes Yes logic distributed No
MATLAB Highly domain-specific numerical computing Yes Yes Yes No
Modula-2 Application system Yes Yes 1996 ISO
Modula-3 Application Yes Yes Yes No
MUMPS (M) Application databases Yes Yes concurrent multi-user NoSQL transaction processing 1977 ANSI
Nim Application general web scripting system Yes Yes Yes Yes Yes Yes multiple dispatch Concurrent meta No
Oberon Application system Yes Yes No
Object Pascal Application general mobile app web Yes Yes Yes Yes Yes Yes structured No
Objective-C Application general Yes Yes Yes concurrent No
OCaml Application Yes Yes Yes Yes No
Occam General Yes Yes concurrent process-oriented No
Opa Web applications Yes Yes Yes distributed No
Oxygene Application Yes Yes Yes No
Oz-Mozart Application distribution education Yes Yes Yes concurrent logic No
Pascal Application education Yes Yes 1983 ISO
Perl Application scripting text processing Web Yes Yes Yes Yes Yes Yes No
PHP Server-side web application web Yes Yes Yes Yes Yes No
PL/I Application Yes Yes Yes 1969
Plus Application system development Yes Yes No
Prolog Application artificial intelligence logic 1995 ISO
PureBasic Application Yes No
Python Application general web scripting artificial intelligence scientific computing Yes Yes Yes Yes Yes aspect-oriented No
R Application statistics Yes Yes Yes Yes No
Racket Education general scripting Yes Yes Yes Yes modular logic meta No
REALbasic Application Yes Unknown
REBOL Distributed Yes Yes Yes dialected No
RPG Application system Yes Yes No
Ruby Application scripting web Yes Yes Yes Yes aspect-oriented 2011(JIS X 3017) 2012(ISO/IEC 30170)
Rust Application system Yes Yes Yes Yes Yes concurrent No
S Application statistics Yes Yes Yes Yes No
S-Lang Application numerical scripting Yes Yes No
Scala Application distributed web Yes Yes Yes Yes Yes Yes De facto standard via Scala Language Specification (SLS)
Scheme Education general Yes 1998 R6RS
Seed7 Application general scripting web Yes Yes Yes Yes multi-paradigm extensible structured No
Simula Education general Yes Yes Yes discrete event simulation multi-threaded (quasi-parallel) program execution 1968
Small Basic Application education games Yes Yes component-oriented No
Smalltalk Application general business artificial intelligence education web Yes Yes Yes Yes Yes concurrent declarative 1998 ANSI
SNOBOL Text processing Unknown
Standard ML Application Yes Yes Yes 1997 SML '97
Swift Application general Yes Yes Yes Yes Yes Yes concurrent No
Tcl Application scripting web Yes Yes Yes Yes Yes Yes No
Visual Basic Application RAD education business general (Includes VBA) office automation Yes Yes Yes Yes component-oriented No
Visual Basic .NET Application RAD education web business general Yes Yes Yes Yes Yes Yes Yes structured concurrent No
Visual FoxPro Application Yes data-centric logic No
Visual Prolog Application Yes Yes Yes Yes declarative logic No
Windows PowerShell Administration Yes Yes Yes Yes pipeline No
Wolfram Language Symbolic language Yes Yes Yes Yes logic distributed No
XL Yes Yes concept programming No
Xojo Application RAD general web Yes Yes Yes Yes Yes No
XPath/XQuery Databases data processing scripting Yes tree-oriented W3C 1999 XPath 1 2010 XQuery 1 2014 XPath/XQuery 3.0
# -*- coding: utf-8 -*-
from jubatus.recommender import client
from jubatus.recommender import types
from jubatus.common import Datum
def read_tsv(data_path):
with open(data_path) as f:
for line in f:
yield line.split('\t')
if __name__ == '__main__':
recommender = client.Recommender('127.0.0.1', 9199, 'sample')
it = read_tsv('./programming_languages.tsv')
next(it) # skip header
for row in it:
data_dict = {}
language = row[0]
data_dict['Intentd use'] = row[1]
data_dict['Imperative'] = row[2]
data_dict['Object-oriented'] = row[3]
data_dict['Functional'] = row[4]
data_dict['Procedural'] = row[5]
data_dict['Generic'] = row[6]
data_dict['Reflective'] = row[7]
data_dict['Event-driven'] = row[8]
data_dict['Other paradigm(s)'] = row[9]
d = Datum(data_dict)
recommender.update_row(language, d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment