[112687] trunk/dports/math/crfsuite
hum at macports.org
hum at macports.org
Tue Oct 29 07:14:06 PDT 2013
Revision: 112687
https://trac.macports.org/changeset/112687
Author: hum at macports.org
Date: 2013-10-29 07:14:05 -0700 (Tue, 29 Oct 2013)
Log Message:
-----------
crfsuite: update to 0.12.2; install doc and examples according to the standard file hierarchy; install bench scripts.
Modified Paths:
--------------
trunk/dports/math/crfsuite/Portfile
Added Paths:
-----------
trunk/dports/math/crfsuite/files/patch-bench.diff
Modified: trunk/dports/math/crfsuite/Portfile
===================================================================
--- trunk/dports/math/crfsuite/Portfile 2013-10-29 14:11:57 UTC (rev 112686)
+++ trunk/dports/math/crfsuite/Portfile 2013-10-29 14:14:05 UTC (rev 112687)
@@ -4,7 +4,8 @@
PortSystem 1.0
PortGroup github 1.0
-github.setup chokkan crfsuite 0.12
+github.setup chokkan crfsuite 961809adc379148892022276fc9367dfcb2b680f
+version 0.12.2
categories math textproc
maintainers hum openmaintainer
@@ -16,8 +17,8 @@
platforms darwin
license BSD
-checksums rmd160 f202eeb0fcf29b3e0b0c49d84b111c3bf2b764aa \
- sha256 7ac996883f3f925c8bf233a5d7c1462034f68df728775c8dc781faeaf7cd00ff
+checksums rmd160 ba5e127e3d8e5d1bb2a344e7e96259bb328f9bb7 \
+ sha256 8931f215e6f9b230cc2dc440fcd890c37afa3b1df3e8da512c7e74cafba8f0c5
depends_build port:libtool \
port:autoconf \
@@ -25,10 +26,41 @@
depends_lib port:liblbfgs
patchfiles patch-autogen.sh.diff \
- patch-configure.in.diff
+ patch-configure.in.diff \
+ patch-bench.diff
pre-configure {
system -W ${worksrcpath} "./autogen.sh"
}
configure.args --with-liblbfgs=${prefix}
+
+post-destroot {
+ # install additional documents.
+ set dest_doc ${destroot}${prefix}/share/doc/${name}
+ xinstall -d ${dest_doc}
+ xinstall -m 644 -W ${worksrcpath} \
+ AUTHORS COPYING ChangeLog README \
+ ${dest_doc}
+ # install example scripts.
+ xinstall -d ${destroot}${prefix}/share/examples
+ set ex ${prefix}/share/examples/${name}
+ copy ${worksrcpath}/example ${destroot}/${ex}
+ # install benchmark scripts.
+ set bench ${ex}/bench
+ copy ${worksrcpath}/bench ${destroot}/${bench}
+ foreach py {bench_crfpp.py bench_crfsgd.py bench_crfsuite.py bench_wapiti.py collect.py} {
+ reinplace "s|@PREFIX@|${prefix}|g" ${destroot}/${bench}/${py}
+ reinplace "s|@BENCH@|${bench}|g" ${destroot}/${bench}/${py}
+ }
+ reinplace "s|@TEMPLATE_CRFPP@|${prefix}/share/examples/crfpp/chunking/template|g" \
+ ${destroot}/${bench}/bench_crfpp.py
+ reinplace "s|@TEMPLATE_CRFPP@|${prefix}/share/examples/sgd/crf/template|g" \
+ ${destroot}/${bench}/bench_crfsgd.py
+ reinplace "s|@TEMPLATE_WAPITI@|${prefix}/share/examples/wapiti/chpattern.txt|g" \
+ ${destroot}/${bench}/bench_wapiti.py
+}
+
+# Note:
+# To run benchmark scripts in ${prefix}/share/examples/${name}/bench,
+# please install the following ports: wapiti, sgd, crfpp, mallet.
Added: trunk/dports/math/crfsuite/files/patch-bench.diff
===================================================================
--- trunk/dports/math/crfsuite/files/patch-bench.diff (rev 0)
+++ trunk/dports/math/crfsuite/files/patch-bench.diff 2013-10-29 14:14:05 UTC (rev 112687)
@@ -0,0 +1,328 @@
+--- bench/bench_crfpp.py.orig 2011-08-11 12:02:41.000000000 +0900
++++ bench/bench_crfpp.py 2013-10-27 00:09:07.000000000 +0900
+@@ -5,9 +5,10 @@
+ import string
+ from bench import *
+
+-CRFPP_LEARN='/home/okazaki/local/bin/crf_learn'
+-CRFPP_TEST='/home/okazaki/local/bin/crf_test'
++CRFPP_LEARN='@PREFIX@/bin/crf_learn'
++CRFPP_TEST='@PREFIX@/bin/crf_test'
+ OUTDIR='crfpp/'
++LOGDIR='logs/'
+
+ training_patterns = (
+ ('num_features', r'^Number of features:[ ]*(\d+)', 1, int, last),
+@@ -31,6 +32,10 @@
+
+ if __name__ == '__main__':
+ fe = sys.stderr
++ if not os.path.exists(OUTDIR):
++ os.makedirs(OUTDIR)
++ if not os.path.exists(LOGDIR):
++ os.makedirs(LOGDIR)
+
+ R = {}
+ for name, param in params.iteritems():
+@@ -40,7 +45,7 @@
+ tglog = OUTDIR + name + '.tg.log'
+
+ s = string.Template(
+- '$crfpp_learn $param template.crfpp train.txt $model > $trlog'
++ '$crfpp_learn $param @TEMPLATE_CRFPP@ train.txt $model > $trlog'
+ )
+ cmd = s.substitute(
+ crfpp_learn=CRFPP_LEARN,
+@@ -51,14 +56,14 @@
+
+ fe.write(cmd)
+ fe.write('\n')
+- #os.system(cmd)
++ os.system(cmd)
+
+ fo = open(trtxt, 'w')
+ fo.write('$ %s\n' % cmd)
+ fo.write(open(trlog, 'r').read())
+
+ s = string.Template(
+- '$crfpp_test -m $model test.txt | ./accuracy.py > $tglog'
++ '$crfpp_test -m $model test.txt | @BENCH@/accuracy.py > $tglog'
+ )
+ cmd = s.substitute(
+ crfpp_test=CRFPP_TEST,
+@@ -68,7 +73,7 @@
+
+ fe.write(cmd)
+ fe.write('\n')
+- #os.system(cmd)
++ os.system(cmd)
+
+ D = analyze_log(open(trlog), training_patterns)
+ D.update(analyze_log(open(tglog), tagging_patterns))
+--- bench/bench_crfsgd.py.orig 2011-08-11 12:02:41.000000000 +0900
++++ bench/bench_crfsgd.py 2013-10-27 00:09:29.000000000 +0900
+@@ -5,8 +5,9 @@
+ import string
+ from bench import *
+
+-CRFSGD='/home/okazaki/install/sgd-1.3/crf/crfsgd'
++CRFSGD='@PREFIX@/bin/crfsgd'
+ OUTDIR='crfsgd/'
++LOGDIR='logs/'
+
+ training_patterns = (
+ ('num_features', r'features: (\d+)', 1, int, last),
+@@ -26,6 +27,10 @@
+
+ if __name__ == '__main__':
+ fe = sys.stderr
++ if not os.path.exists(OUTDIR):
++ os.makedirs(OUTDIR)
++ if not os.path.exists(LOGDIR):
++ os.makedirs(LOGDIR)
+
+ R = {}
+ for name, param in params.iteritems():
+@@ -35,7 +40,7 @@
+ tglog = OUTDIR + name + '.tg.log'
+
+ s = string.Template(
+- '$crfsgd $param $model template.crfpp train.txt > $trlog'
++ '$crfsgd $param $model @TEMPLATE_CRFPP@ train.txt > $trlog'
+ )
+ cmd = s.substitute(
+ crfsgd=CRFSGD,
+@@ -46,14 +51,14 @@
+
+ fe.write(cmd)
+ fe.write('\n')
+- #os.system(cmd)
++ os.system(cmd)
+
+ fo = open(trtxt, 'w')
+ fo.write('$ %s\n' % cmd)
+ fo.write(open(trlog, 'r').read())
+
+ s = string.Template(
+- '$crfsgd -t $model test.txt | ./accuracy.py > $tglog'
++ '$crfsgd -t $model test.txt | @BENCH@/accuracy.py > $tglog'
+ )
+ cmd = s.substitute(
+ crfsgd=CRFSGD,
+@@ -63,7 +68,7 @@
+
+ fe.write(cmd)
+ fe.write('\n')
+- #os.system(cmd)
++ os.system(cmd)
+
+ D = analyze_log(open(trlog), training_patterns)
+ D.update(analyze_log(open(tglog), tagging_patterns))
+--- bench/bench_crfsuite.py.orig 2011-08-11 12:02:41.000000000 +0900
++++ bench/bench_crfsuite.py 2013-10-27 00:42:02.000000000 +0900
+@@ -5,8 +5,10 @@
+ import string
+ from bench import *
+
+-CRFSUITE='/home/okazaki/projects/crfsuite/frontend/crfsuite'
++CRFSUITE='@PREFIX@/bin/crfsuite'
++CHUNKING='@PREFIX@/share/examples/crfsuite/chunking.py'
+ OUTDIR='crfsuite/'
++LOGDIR='logs/'
+
+ training_patterns = (
+ ('num_features', r'^Number of features: (\d+)', 1, int, last),
+@@ -34,6 +36,23 @@
+
+ if __name__ == '__main__':
+ fe = sys.stderr
++ if not os.path.exists(OUTDIR):
++ os.makedirs(OUTDIR)
++ if not os.path.exists(LOGDIR):
++ os.makedirs(LOGDIR)
++
++ for t in ('train', 'test'):
++ s = string.Template(
++ '$chunking < $t.txt > $t.crfsuite'
++ )
++ cmd = s.substitute(
++ chunking=CHUNKING,
++ t=t
++ )
++
++ fe.write(cmd)
++ fe.write('\n')
++ os.system(cmd)
+
+ R = {}
+ for name, param in params.iteritems():
+@@ -54,7 +73,7 @@
+
+ fe.write(cmd)
+ fe.write('\n')
+- #os.system(cmd)
++ os.system(cmd)
+
+ fo = open(trtxt, 'w')
+ fo.write('$ %s\n' % cmd)
+@@ -71,7 +90,7 @@
+
+ fe.write(cmd)
+ fe.write('\n')
+- #os.system(cmd)
++ os.system(cmd)
+
+ D = analyze_log(open(trlog), training_patterns)
+ D.update(analyze_log(open(tglog), tagging_patterns))
+--- bench/bench_mallet.py.orig 2011-08-11 12:02:41.000000000 +0900
++++ bench/bench_mallet.py 2013-10-27 00:42:42.000000000 +0900
+@@ -5,8 +5,9 @@
+ import string
+ from bench import *
+
+-MALLET='java -cp "/home/okazaki/install/mallet-2.0.6/class:/home/okazaki/install/mallet-2.0.6/lib/mallet-deps.jar" cc.mallet.fst.SimpleTagger'
++MALLET='@PREFIX@/bin/mallet'
+ OUTDIR='mallet/'
++LOGDIR='logs/'
+
+ training_patterns = (
+ ('num_features', r'^Number of weights = (\d+)', 1, int, last),
+@@ -29,6 +30,23 @@
+
+ if __name__ == '__main__':
+ fe = sys.stderr
++ if not os.path.exists(OUTDIR):
++ os.makedirs(OUTDIR)
++ if not os.path.exists(LOGDIR):
++ os.makedirs(LOGDIR)
++
++ for t in ('train', 'test'):
++ s = string.Template(
++ '$mallet import-file --input $t.txt --output $t.mallet'
++ )
++ cmd = s.substitute(
++ mallet=MALLET,
++ t=t
++ )
++
++ fe.write(cmd)
++ fe.write('\n')
++ os.system(cmd)
+
+ R = {}
+ for name, param in params.iteritems():
+@@ -38,7 +56,7 @@
+ tglog = OUTDIR + name + '.tg.log'
+
+ s = string.Template(
+- 'time $mallet --train true $param --model-file $model train.mallet > $trlog 2>&1'
++ 'time $mallet tag --train true $param --model-file $model train.mallet > $trlog 2>&1'
+ )
+ cmd = s.substitute(
+ mallet=MALLET,
+@@ -49,14 +67,14 @@
+
+ fe.write(cmd)
+ fe.write('\n')
+- #os.system(cmd)
++ os.system(cmd)
+
+ fo = open(trtxt, 'w')
+ fo.write('$ %s\n' % cmd)
+ fo.write(open(trlog, 'r').read())
+
+ s = string.Template(
+- '$mallet --model-file $model --test lab test.mallet > $tglog 2>&1'
++ '$mallet tag --model-file $model --test lab test.mallet > $tglog 2>&1'
+ )
+ cmd = s.substitute(
+ mallet=MALLET,
+@@ -66,7 +84,7 @@
+
+ fe.write(cmd)
+ fe.write('\n')
+- #os.system(cmd)
++ os.system(cmd)
+
+ D = analyze_log(open(trlog), training_patterns)
+ D['update'] = 0.
+--- bench/bench_wapiti.py.orig 2011-08-11 12:02:41.000000000 +0900
++++ bench/bench_wapiti.py 2013-10-27 00:10:09.000000000 +0900
+@@ -5,8 +5,9 @@
+ import string
+ from bench import *
+
+-WAPITI='/home/okazaki/install/wapiti-1.1.3/wapiti'
++WAPITI='@PREFIX@/bin/wapiti'
+ OUTDIR='wapiti/'
++LOGDIR='logs/'
+
+ training_patterns = (
+ ('num_features', r'nb features: (\d+)', 1, int, last),
+@@ -30,6 +31,10 @@
+
+ if __name__ == '__main__':
+ fe = sys.stderr
++ if not os.path.exists(OUTDIR):
++ os.makedirs(OUTDIR)
++ if not os.path.exists(LOGDIR):
++ os.makedirs(LOGDIR)
+
+ R = {}
+ for name, param in params.iteritems():
+@@ -39,7 +44,7 @@
+ tglog = OUTDIR + name + '.tg.log'
+
+ s = string.Template(
+- 'time $wapiti train $param -p template.wapiti train.txt $model > $trlog 2>&1'
++ 'time $wapiti train $param -p @TEMPLATE_WAPITI@ train.txt $model > $trlog 2>&1'
+ )
+ cmd = s.substitute(
+ wapiti=WAPITI,
+@@ -50,14 +55,14 @@
+
+ fe.write(cmd)
+ fe.write('\n')
+- #os.system(cmd)
++ os.system(cmd)
+
+ fo = open(trtxt, 'w')
+ fo.write('$ %s\n' % cmd)
+ fo.write(open(trlog, 'r').read())
+
+ s = string.Template(
+- '$wapiti label -m $model test.txt | ./accuracy.py > $tglog'
++ '$wapiti label -m $model test.txt | @BENCH@/accuracy.py > $tglog'
+ )
+ cmd = s.substitute(
+ wapiti=WAPITI,
+@@ -67,7 +72,7 @@
+
+ fe.write(cmd)
+ fe.write('\n')
+- #os.system(cmd)
++ os.system(cmd)
+
+ D = analyze_log(open(trlog), training_patterns)
+ D.update(analyze_log(open(tglog), tagging_patterns))
+--- bench/collect.py.orig 2011-08-11 12:02:41.000000000 +0900
++++ bench/collect.py 2013-10-26 22:37:17.000000000 +0900
+@@ -4,12 +4,12 @@
+ import os
+
+ scripts = (
+- ('CRFsuite 0.12', './bench_crfsuite.py'),
+- ('CRFsuite 0.11', './bench_crfsuite-0.11.py'),
+- ('Wapiti v1.1.3', './bench_wapiti.py'),
+- ('sgd 1.3', './bench_crfsgd.py'),
+- ('CRF++ 0.54', './bench_crfpp.py'),
+- ('MALLET 2.0.6', './bench_mallet.py'),
++ ('CRFsuite 0.12', '@BENCH@/bench_crfsuite.py'),
++# ('CRFsuite 0.11', './bench_crfsuite-0.11.py'),
++ ('Wapiti v1.4.0', '@BENCH@/bench_wapiti.py'),
++ ('sgd 2.1', '@BENCH@/bench_crfsgd.py'),
++ ('CRF++ 0.58', '@BENCH@/bench_crfpp.py'),
++ ('MALLET 2.0.7', '@BENCH@/bench_mallet.py'),
+ )
+
+ fields = (
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20131029/3dc44fe0/attachment.html>
More information about the macports-changes
mailing list