<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[117348] trunk/dports/textproc</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="https://trac.macports.org/changeset/117348">117348</a></dd>
<dt>Author</dt> <dd>hum@macports.org</dd>
<dt>Date</dt> <dd>2014-02-23 06:36:18 -0800 (Sun, 23 Feb 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>New port: word2vec @20131218 - Tool for computing continuous distributed representations of words.</pre>

<h3>Added Paths</h3>
<ul>
<li>trunk/dports/textproc/word2vec/</li>
<li><a href="#trunkdportstextprocword2vecPortfile">trunk/dports/textproc/word2vec/Portfile</a></li>
<li>trunk/dports/textproc/word2vec/files/</li>
<li><a href="#trunkdportstextprocword2vecfilespatchcomputeaccuracycdiff">trunk/dports/textproc/word2vec/files/patch-compute-accuracy.c.diff</a></li>
<li><a href="#trunkdportstextprocword2vecfilespatchdemodiff">trunk/dports/textproc/word2vec/files/patch-demo.diff</a></li>
<li><a href="#trunkdportstextprocword2vecfilespatchmallocdiff">trunk/dports/textproc/word2vec/files/patch-malloc.diff</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkdportstextprocword2vecPortfile"></a>
<div class="addfile"><h4>Added: trunk/dports/textproc/word2vec/Portfile (0 => 117348)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/textproc/word2vec/Portfile                                (rev 0)
+++ trunk/dports/textproc/word2vec/Portfile        2014-02-23 14:36:18 UTC (rev 117348)
</span><span class="lines">@@ -0,0 +1,65 @@
</span><ins>+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
+# $Id$
+
+PortSystem          1.0
+
+name                word2vec
+version             20131218
+categories          textproc
+maintainers         hum openmaintainer
+
+description         Tool for computing continuous distributed representations of words
+
+long_description    This tool provides an efficient implementation of the \
+                    continuous bag-of-words and skip-gram architectures for \
+                    computing vector representations of words. These \
+                    representations can be subsequently used in many natural \
+                    language processing applications and for further research.
+
+homepage            https://code.google.com/p/word2vec/
+platforms           darwin
+license             Apache-2
+
+fetch.type          svn
+svn.url             http://word2vec.googlecode.com/svn/trunk
+svn.revision        37
+worksrcdir          trunk
+
+patchfiles          patch-malloc.diff \
+                    patch-compute-accuracy.c.diff \
+                    patch-demo.diff
+
+use_configure       no
+variant universal   {}
+
+configure.optflags  -O2
+
+build.args          CC=&quot;${configure.cc}&quot; \
+                    CFLAGS=&quot;${configure.cflags} [get_canonical_archflags] -lm -pthread -Wall -funroll-loops -Wunused-result&quot;
+
+destroot {
+    set execdir ${prefix}/libexec/${name}
+    xinstall -d ${destroot}${execdir}
+    xinstall -m 755 -W ${worksrcpath} \
+        word2vec word2phrase distance word-analogy compute-accuracy \
+        demo-analogy.sh demo-classes.sh demo-phrase-accuracy.sh \
+        demo-phrases.sh demo-word-accuracy.sh demo-word.sh \
+        ${destroot}${execdir}
+    set exdir ${prefix}/share/examples/${name}
+    xinstall -d ${destroot}${exdir}
+    xinstall -m 644 -W ${worksrcpath} \
+        questions-phrases.txt questions-words.txt \
+        ${destroot}${exdir}
+    # fix demo scripts.
+    foreach f [glob ${destroot}${execdir}/demo-*.sh] {
+        reinplace &quot;s|@EXECDIR@|${execdir}|g&quot; ${f}
+        reinplace &quot;s|@EXDIR@|${exdir}|g&quot; ${f}
+    }
+    set docdir ${prefix}/share/doc/${name}
+    xinstall -d ${destroot}${docdir}
+    xinstall -m 644 -W ${worksrcpath} \
+        LICENSE README.txt \
+        ${destroot}${docdir}
+}
+
+livecheck.url       none
</ins><span class="cx">Property changes on: trunk/dports/textproc/word2vec/Portfile
</span><span class="cx">___________________________________________________________________
</span></span></pre></div>
<a id="svnkeywords"></a>
<div class="addfile"><h4>Added: svn:keywords</h4></div>
<a id="svneolstyle"></a>
<div class="addfile"><h4>Added: svn:eol-style</h4></div>
<a id="trunkdportstextprocword2vecfilespatchcomputeaccuracycdiff"></a>
<div class="addfile"><h4>Added: trunk/dports/textproc/word2vec/files/patch-compute-accuracy.c.diff (0 => 117348)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/textproc/word2vec/files/patch-compute-accuracy.c.diff                                (rev 0)
+++ trunk/dports/textproc/word2vec/files/patch-compute-accuracy.c.diff        2014-02-23 14:36:18 UTC (rev 117348)
</span><span class="lines">@@ -0,0 +1,12 @@
</span><ins>+--- compute-accuracy.c.orig        2014-02-23 20:29:23.000000000 +0900
++++ compute-accuracy.c        2014-02-23 20:30:44.000000000 +0900
+@@ -28,7 +28,8 @@
+   FILE *f;
+   char st1[max_size], st2[max_size], st3[max_size], st4[max_size], bestw[N][max_size], file_name[max_size], ch;
+   float dist, len, bestd[N], vec[max_size];
+-  long long words, size, a, b, c, d, b1, b2, b3, threshold = 0;
++  long long words, size, b, c, d, b1, b2, b3, threshold = 0;
++  volatile long long a = 0;
+   float *M;
+   char *vocab;
+   int TCN, CCN = 0, TACN = 0, CACN = 0, SECN = 0, SYCN = 0, SEAC = 0, SYAC = 0, QID = 0, TQ = 0, TQS = 0;
</ins></span></pre></div>
<a id="trunkdportstextprocword2vecfilespatchdemodiff"></a>
<div class="addfile"><h4>Added: trunk/dports/textproc/word2vec/files/patch-demo.diff (0 => 117348)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/textproc/word2vec/files/patch-demo.diff                                (rev 0)
+++ trunk/dports/textproc/word2vec/files/patch-demo.diff        2014-02-23 14:36:18 UTC (rev 117348)
</span><span class="lines">@@ -0,0 +1,116 @@
</span><ins>+--- demo-analogy.sh.orig        2014-02-22 20:36:04.000000000 +0900
++++ demo-analogy.sh        2014-02-22 20:27:27.000000000 +0900
+@@ -1,11 +1,13 @@
+-make
++#!/bin/sh
+ if [ ! -e text8 ]; then
+-  wget http://mattmahoney.net/dc/text8.zip -O text8.gz
+-  gzip -d text8.gz -f
++  curl -O http://mattmahoney.net/dc/text8.zip
++  unzip text8.zip
+ fi
+ echo -----------------------------------------------------------------------------------------------------
+ echo Note that for the word analogy to perform well, the models should be trained on much larger data sets
+ echo Example input: paris france berlin
+ echo -----------------------------------------------------------------------------------------------------
+-time ./word2vec -train text8 -output vectors.bin -cbow 0 -size 200 -window 5 -negative 0 -hs 1 -sample 1e-3 -threads 12 -binary 1
+-./word-analogy vectors.bin
++if [ ! -e vectors.bin ]; then
++  time @EXECDIR@/word2vec -train text8 -output vectors.bin -cbow 0 -size 200 -window 5 -negative 0 -hs 1 -sample 1e-3 -threads 12 -binary 1
++fi
++@EXECDIR@/word-analogy vectors.bin
+--- demo-classes.sh.orig        2014-02-22 20:36:09.000000000 +0900
++++ demo-classes.sh        2014-02-22 20:22:53.000000000 +0900
+@@ -1,8 +1,8 @@
+-make
++#!/bin/sh
+ if [ ! -e text8 ]; then
+-  wget http://mattmahoney.net/dc/text8.zip -O text8.gz
+-  gzip -d text8.gz -f
++  curl -O http://mattmahoney.net/dc/text8.zip
++  unzip text8.zip
+ fi
+-time ./word2vec -train text8 -output classes.txt -cbow 0 -size 200 -window 5 -negative 0 -hs 1 -sample 1e-3 -threads 12 -classes 500
++time @EXECDIR@/word2vec -train text8 -output classes.txt -cbow 0 -size 200 -window 5 -negative 0 -hs 1 -sample 1e-3 -threads 12 -classes 500
+ sort classes.txt -k 2 -n &gt; classes.sorted.txt
+ echo The word classes were saved to file classes.sorted.txt
+--- demo-phrase-accuracy.sh.orig        2014-02-22 20:36:25.000000000 +0900
++++ demo-phrase-accuracy.sh        2014-02-22 20:29:40.000000000 +0900
+@@ -1,12 +1,14 @@
+-make
++#!/bin/sh
+ if [ ! -e text8 ]; then
+-  wget http://mattmahoney.net/dc/text8.zip -O text8.gz
+-  gzip -d text8.gz -f
++  curl -O http://mattmahoney.net/dc/text8.zip
++  unzip text8.zip
+ fi
+ echo ----------------------------------------------------------------------------------------------------------------
+ echo Note that the accuracy and coverage of the test set questions is going to be low with this small training corpus
+ echo To achieve better accuracy, larger training set is needed
+ echo ----------------------------------------------------------------------------------------------------------------
+-time ./word2phrase -train text8 -output text8-phrase -threshold 500 -debug 2 -min-count 3
+-time ./word2vec -train text8-phrase -output vectors-phrase.bin -cbow 0 -size 300 -window 10 -negative 0 -hs 1 -sample 1e-3 -threads 12 -binary 1 -min-count 3
+-./compute-accuracy vectors-phrase.bin &lt;questions-phrases.txt
++if [ ! -e vectors-phrase.bin ]; then
++  time @EXECDIR@/word2phrase -train text8 -output text8-phrase -threshold 500 -debug 2 -min-count 3
++  time @EXECDIR@/word2vec -train text8-phrase -output vectors-phrase.bin -cbow 0 -size 300 -window 10 -negative 0 -hs 1 -sample 1e-3 -threads 12 -binary 1 -min-count 3
++fi
++@EXECDIR@/compute-accuracy vectors-phrase.bin &lt; @EXDIR@/questions-phrases.txt
+--- demo-phrases.sh.orig        2014-02-22 20:36:17.000000000 +0900
++++ demo-phrases.sh        2014-02-22 20:30:19.000000000 +0900
+@@ -1,8 +1,10 @@
+-make
++#!/bin/sh
+ if [ ! -e text8 ]; then
+-  wget http://mattmahoney.net/dc/text8.zip -O text8.gz
+-  gzip -d text8.gz -f
++  curl -O http://mattmahoney.net/dc/text8.zip
++  unzip text8.zip
+ fi
+-time ./word2phrase -train text8 -output text8-phrase -threshold 500 -debug 2
+-time ./word2vec -train text8-phrase -output vectors-phrase.bin -cbow 0 -size 300 -window 10 -negative 0 -hs 1 -sample 1e-3 -threads 12 -binary 1
+-./distance vectors-phrase.bin
+\ No newline at end of file
++if [ ! -e vectors-phrase.bin ]; then
++  time @EXECDIR@/word2phrase -train text8 -output text8-phrase -threshold 500 -debug 2
++  time @EXECDIR@/word2vec -train text8-phrase -output vectors-phrase.bin -cbow 0 -size 300 -window 10 -negative 0 -hs 1 -sample 1e-3 -threads 12 -binary 1
++fi
++@EXECDIR@/distance vectors-phrase.bin
+--- demo-word-accuracy.sh.orig        2014-02-22 20:36:32.000000000 +0900
++++ demo-word-accuracy.sh        2014-02-22 20:31:16.000000000 +0900
+@@ -1,8 +1,10 @@
+-make
++#!/bin/sh
+ if [ ! -e text8 ]; then
+-  wget http://mattmahoney.net/dc/text8.zip -O text8.gz
+-  gzip -d text8.gz -f
++  curl -O http://mattmahoney.net/dc/text8.zip
++  unzip text8.zip
+ fi
+-time ./word2vec -train text8 -output vectors.bin -cbow 0 -size 200 -window 5 -negative 0 -hs 1 -sample 1e-3 -threads 12 -binary 1
+-./compute-accuracy vectors.bin 30000 &lt; questions-words.txt
+-# to compute accuracy with the full vocabulary, use: ./compute-accuracy vectors.bin &lt; questions-words.txt
++if [ ! -e vectors.bin ]; then
++  time @EXECDIR@/word2vec -train text8 -output vectors.bin -cbow 0 -size 200 -window 5 -negative 0 -hs 1 -sample 1e-3 -threads 12 -binary 1
++fi
++@EXECDIR@/compute-accuracy vectors.bin 30000 &lt; @EXDIR@/questions-words.txt
++# to compute accuracy with the full vocabulary, use: @EXECDIR@/compute-accuracy vectors.bin &lt; @EXDIR@/questions-words.txt
+--- demo-word.sh.orig        2014-02-22 20:36:47.000000000 +0900
++++ demo-word.sh        2014-02-22 20:31:57.000000000 +0900
+@@ -1,7 +1,9 @@
+-make
++#!/bin/sh
+ if [ ! -e text8 ]; then
+-  wget http://mattmahoney.net/dc/text8.zip -O text8.gz
+-  gzip -d text8.gz -f
++  curl -O http://mattmahoney.net/dc/text8.zip
++  unzip text8.zip
+ fi
+-time ./word2vec -train text8 -output vectors.bin -cbow 0 -size 200 -window 5 -negative 0 -hs 1 -sample 1e-3 -threads 12 -binary 1
+-./distance vectors.bin
+\ No newline at end of file
++if [ ! -e vectors.bin ]; then
++  time @EXECDIR@/word2vec -train text8 -output vectors.bin -cbow 0 -size 200 -window 5 -negative 0 -hs 1 -sample 1e-3 -threads 12 -binary 1
++fi
++@EXECDIR@/distance vectors.bin
</ins></span></pre></div>
<a id="trunkdportstextprocword2vecfilespatchmallocdiff"></a>
<div class="addfile"><h4>Added: trunk/dports/textproc/word2vec/files/patch-malloc.diff (0 => 117348)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/dports/textproc/word2vec/files/patch-malloc.diff                                (rev 0)
+++ trunk/dports/textproc/word2vec/files/patch-malloc.diff        2014-02-23 14:36:18 UTC (rev 117348)
</span><span class="lines">@@ -0,0 +1,33 @@
</span><ins>+--- compute-accuracy.c.orig        2014-02-22 19:15:25.000000000 +0900
++++ compute-accuracy.c        2014-02-22 19:17:40.000000000 +0900
+@@ -16,7 +16,7 @@
+ #include &lt;stdlib.h&gt;
+ #include &lt;string.h&gt;
+ #include &lt;math.h&gt;
+-#include &lt;malloc.h&gt;
++#include &lt;stdlib.h&gt;
+ #include &lt;ctype.h&gt;

+ const long long max_size = 2000;         // max length of strings
+--- distance.c.orig        2014-02-22 19:15:32.000000000 +0900
++++ distance.c        2014-02-22 19:16:29.000000000 +0900
+@@ -15,7 +15,7 @@
+ #include &lt;stdio.h&gt;
+ #include &lt;string.h&gt;
+ #include &lt;math.h&gt;
+-#include &lt;malloc.h&gt;
++#include &lt;stdlib.h&gt;

+ const long long max_size = 2000;         // max length of strings
+ const long long N = 40;                  // number of closest words that will be shown
+--- word-analogy.c.orig        2014-02-22 19:15:49.000000000 +0900
++++ word-analogy.c        2014-02-22 19:17:27.000000000 +0900
+@@ -15,7 +15,7 @@
+ #include &lt;stdio.h&gt;
+ #include &lt;string.h&gt;
+ #include &lt;math.h&gt;
+-#include &lt;malloc.h&gt;
++#include &lt;stdlib.h&gt;

+ const long long max_size = 2000;         // max length of strings
+ const long long N = 40;                  // number of closest words that will be shown
</ins></span></pre>
</div>
</div>

</body>
</html>