[85145] trunk/dports/textproc/extractopinion

hum at macports.org hum at macports.org
Mon Oct 10 05:56:09 PDT 2011


Revision: 85145
          http://trac.macports.org/changeset/85145
Author:   hum at macports.org
Date:     2011-10-10 05:56:07 -0700 (Mon, 10 Oct 2011)
Log Message:
-----------
extractopinion: update to 1.1; add support for makemdl; simplify setting cflags; add options to executable scripts.

Modified Paths:
--------------
    trunk/dports/textproc/extractopinion/Portfile

Added Paths:
-----------
    trunk/dports/textproc/extractopinion/files/patch-crftrain.sh.diff
    trunk/dports/textproc/extractopinion/files/patch-extract.sh.diff
    trunk/dports/textproc/extractopinion/files/patch-makemdl.sh.diff

Modified: trunk/dports/textproc/extractopinion/Portfile
===================================================================
--- trunk/dports/textproc/extractopinion/Portfile	2011-10-10 12:43:46 UTC (rev 85144)
+++ trunk/dports/textproc/extractopinion/Portfile	2011-10-10 12:56:07 UTC (rev 85145)
@@ -4,24 +4,29 @@
 PortSystem          1.0
 
 name                extractopinion
-version             1.0
+version             1.1
 categories          textproc japanese
 platforms           darwin
 maintainers         hum openmaintainer
-license             BSD LGPL GPL
+license             BSD LGPL-2.1 GPL-2
 
 homepage            http://alaginrc.nict.go.jp/opinion/index.html
-description         an opinion extraction tool for Japanese texts.
-long_description    ${description}
+description         an opinion extraction tool for Japanese texts
+long_description    ${name} is ${description}.
 
 master_sites        http://alaginrc.nict.go.jp/opinion/src/
 
-checksums           sha1    208540479b7b0193bb0273aef99cfb4eebd4de7a \
-                    rmd160  eb143e445c9a9ba50684df184f8fcf0e4c007e4b
+checksums           rmd160  45a35364e5354ee115c5d8a1481809d4cd408390 \
+                    sha256  e940860a719be12c64a0cd573bf8ef1922210690df33c7ca5695097e2f5510fc
 
+patchfiles          patch-extract.sh.diff \
+                    patch-makemdl.sh.diff \
+                    patch-crftrain.sh.diff
+
 depends_lib         port:crfpp \
                     port:nkf \
                     port:gawk \
+                    port:p5-text-csv_xs \
                     port:juman \
                     port:knp
 
@@ -31,18 +36,15 @@
     copy ${filespath}/Makefile ${worksrcpath}
 }
 
-variant universal {}
-if {[variant_isset universal]} {
-    set archflags ${configure.universal_cflags}
-} else {
-    set archflags ${configure.cflags}
-}
+variant universal   {}
 
-build.args         CFLAGS="${archflags}"
+build.args          CC=${configure.cc} CFLAGS="${configure.cflags} [get_canonical_archflags]"
 
 destroot {
-    reinplace "s|dir=`cd \$\(dirname \$0\) && pwd`|dir=${prefix}/share/${distname}|" \
-        ${worksrcpath}/extract.sh
+    foreach script {_extract _train extract makemdl} {
+        reinplace "s|dir=`cd \$\(dirname \$0\) && pwd`|dir=${prefix}/share/${distname}|" \
+            ${worksrcpath}/${script}.sh
+    }
     reinplace "s|dir=|#dir=|" ${worksrcpath}/conf.sh
     foreach script {pol/out2tsv pol/par2dat pol/tsv2par \
                         src/makefv src/otag2tsv src/out2tsv src/tsv2tag src/tsvconv \
@@ -51,6 +53,7 @@
         reinplace "s|/usr/bin/gawk|${prefix}/bin/gawk|" ${worksrcpath}/${script}.awk
     }
     copy ${worksrcpath}/extract.sh ${destroot}${prefix}/bin/extractopinion.sh
+    copy ${worksrcpath}/makemdl.sh ${destroot}${prefix}/bin/extractopinion-makemdl.sh
     copy ${worksrcpath}            ${destroot}${prefix}/share
 }
 

Added: trunk/dports/textproc/extractopinion/files/patch-crftrain.sh.diff
===================================================================
--- trunk/dports/textproc/extractopinion/files/patch-crftrain.sh.diff	                        (rev 0)
+++ trunk/dports/textproc/extractopinion/files/patch-crftrain.sh.diff	2011-10-10 12:56:07 UTC (rev 85145)
@@ -0,0 +1,10 @@
+--- src/crftrain.sh.orig	2011-09-21 11:51:17.000000000 +0900
++++ src/crftrain.sh	2011-10-07 22:00:32.000000000 +0900
+@@ -16,6 +16,6 @@
+ tagfile=$tmp/crftrain.$$.tag
+ 
+ $dir/tsv2tag.awk -f $exlib/utility.awk -v SCRIPT=$dir/tsv2tag.awk > $tagfile
+-$crf_learn -c $param_c $dir/template $tagfile $mdlfile
++$crf_learn -c $param_c $dir/../xpr/template $tagfile $mdlfile
+ 
+ rm -f $tagfile

Added: trunk/dports/textproc/extractopinion/files/patch-extract.sh.diff
===================================================================
--- trunk/dports/textproc/extractopinion/files/patch-extract.sh.diff	                        (rev 0)
+++ trunk/dports/textproc/extractopinion/files/patch-extract.sh.diff	2011-10-10 12:56:07 UTC (rev 85145)
@@ -0,0 +1,47 @@
+--- extract.sh.orig	2011-09-21 11:51:06.000000000 +0900
++++ extract.sh	2011-10-07 23:24:41.000000000 +0900
+@@ -1,11 +1,5 @@
+ #!/bin/sh
+ 
+-if [ $# -lt 1 -o  $# -gt 3  ]
+-then
+-    echo "Usage $0 file_name [topic_str]"
+-    exit -1;
+-fi
+-
+ dir=`cd $(dirname $0) && pwd`
+ . $dir/conf.sh
+ 
+@@ -13,10 +7,31 @@
+ export EXOPLIB=$dir/lib
+ export EXOPDIC=$dir/dic
+ 
++cmd=`basename $0`
++
++usage() {
++  echo "Usage: $cmd [options] file_name [topic_str]"
++  echo "Options: -h, --help            Show this message"
++  echo "         -d, --dictionary DIR  Specify the dictionary directory"
++  echo "         -m, --model      BASE Specify the base path of model files"
++  echo "         -t, --tmpdir     DIR  Specify the temporary directory"
++  exit -1
++}
++
++while test -n "$1"; do
++    case "$1" in
++        -h|--help)       usage ;;
++        -d|--dictionary) dictionary="$2"; shift 2 ;;
++        -m|--model)      model="$2";      shift 2 ;;
++        -t|--tmpdir)     TMPDIR="$2";     shift 2 ;;
++        *)               file_name="$1"; topic_str="$2";  break ;;
++    esac
++done
++
+ tmp=${TMPDIR:-.}
+ tsvfile=$tmp/extract.$$.tsv
+ 
+-perl -I $EXOPLIB $EXOPLIB/in2tsv.pl $1 $2 > $tsvfile
++perl -I $EXOPLIB $EXOPLIB/in2tsv.pl $file_name $topic_str > $tsvfile
+ $dir/_extract.sh $model $tsvfile | perl -I $EXOPLIB $EXOPLIB/tsv2out.pl
+ 
+ rm -f $tsvfile

Added: trunk/dports/textproc/extractopinion/files/patch-makemdl.sh.diff
===================================================================
--- trunk/dports/textproc/extractopinion/files/patch-makemdl.sh.diff	                        (rev 0)
+++ trunk/dports/textproc/extractopinion/files/patch-makemdl.sh.diff	2011-10-10 12:56:07 UTC (rev 85145)
@@ -0,0 +1,54 @@
+--- makemdl.sh.orig	2011-10-03 22:18:53.000000000 +0900
++++ makemdl.sh	2011-10-07 23:24:50.000000000 +0900
+@@ -9,13 +9,42 @@
+ 
+ export EXOPLIB=$dir/lib
+ 
+-cat $dir/makemodel/tsv/*.tsv > $dir/makemodel/data.tsv
+-cat $dir/makemodel/data.tsv > $dir/makemodel/data_pol.tsv
+-
+-$dir/_train.sh makemodel/model/model $dir/makemodel/data.tsv $dir/makemodel/data.tsv $dir/makemodel/data.tsv $dir/makemodel/data_pol.tsv $dir/makemodel/data.tsv
+-rm $dir/makemodel/data.tsv $dir/makemodel/data_pol.tsv
+-
+-
+-
+-
++cmd=`basename $0`
+ 
++usage() {
++  echo "Usage: $cmd [options] [csvfiles]"
++  echo "Options: -h, --help            Show this message"
++  echo "         -d, --dictionary DIR  Specify the dictionary directory"
++  echo "         -m, --model      BASE Specify the base path of model files"
++  echo "         -t, --tmpdir     DIR  Specify the temporary directory"
++  exit -1
++}
++
++csvfiles=*.csv
++model=./model
++
++while test -n "$1"; do
++    case "$1" in
++        -h|--help)       usage ;;
++        -d|--dictionary) dictionary="$2"; shift 2 ;;
++        -m|--model)      model="$2";      shift 2 ;;
++        -t|--tmpdir)     TMPDIR="$2";     shift 2 ;;
++        *)               csvfiles="$@";   break ;;
++    esac
++done
++
++workdir=${TMPDIR}/extractopinion-$$
++mkdir -p $workdir/tsv
++
++for file in $csvfiles
++do
++  f=`basename $file .csv`
++  perl -I $dir/lib $dir/makemodel/csv/csv2tsv.pl $file > $workdir/tsv/$f.tsv
++done
++
++cat $workdir/tsv/*.tsv > $workdir/data.tsv
++cat $workdir/data.tsv  > $workdir/data_pol.tsv
++
++$dir/_train.sh $model $workdir/data.tsv $workdir/data.tsv $workdir/data.tsv $workdir/data_pol.tsv $workdir/data.tsv
++rm $workdir/data.tsv $workdir/data_pol.tsv
++rm -rf $workdir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20111010/e411664f/attachment.html>


More information about the macports-changes mailing list