Ignore:
Timestamp:
Mar 9, 2012, 12:27:38 PM (7 years ago)
Author:
hum@…
Message:

dualist: update to 0.3; build mecab variant with ant instead of make; remove livecheck to use the default for googlecode.

Location:
trunk/dports/java/dualist
Files:
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/java/dualist/Portfile

    r81620 r90590  
    55
    66name                dualist
    7 version             0.1
    8 revision            1
     7version             0.3
    98categories          java math textproc
    109platforms           darwin
     
    2221homepage            http://code.google.com/p/dualist/
    2322master_sites        googlecode:${name}
    24 
    25 checksums           sha1    7a2fc1fd432c71e2575a1514a946bbf68652fdfa \
    26                     rmd160  8b4ca3fcd3ec42eeda43235c246390f07a849998
     23checksums           rmd160  74cd7775322249a2bd5791e7ca7d6ebbb75d0fb6 \
     24                    sha256  0b49f3d062b3587b7fc1bcd43b7fe8a618ecd869de00db2245209db96a4e8040
    2725
    2826depends_run         port:play
     
    3028use_zip             yes
    3129worksrcdir          ${name}
    32 
    33 set java_home       /System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home
    34 
    35 pre-configure {
    36     if {![file exists ${java_home}]} {
    37         ui_error "Java 1.6 is required, but not located at ${java_home}"
    38         return -code error "Java 1.6 missing"
    39     }
    40 }
    4130
    4231use_configure       no
     
    4635
    4736set share_java_dir  ${prefix}/share/java
    48 set dualist_dir     ${share_java_dir}/${worksrcdir}
     37set dualist_dir     ${share_java_dir}/${distname}
    4938
    5039destroot {
    5140    # Copy the distribution.
    5241    xinstall -m 755 -d  ${destroot}${share_java_dir}
    53     copy ${worksrcpath} ${destroot}${share_java_dir}
     42    copy ${worksrcpath} ${destroot}${dualist_dir}
     43    file attributes ${destroot}${dualist_dir}     -permissions 0777
     44    file attributes ${destroot}${dualist_dir}/gui -permissions 0777
    5445
    55     # Configure working directories.
    56     xinstall -m 1777 -d ${destroot}${dualist_dir}/tmp
    57     file attributes     ${destroot}${dualist_dir}/public/results -permissions 01777
    58     destroot.keepdirs   ${destroot}${dualist_dir}/tmp \
    59                         ${destroot}${dualist_dir}/public/results
    60 
    61     # Install an extra script for this port.
    62     xinstall -m 755 ${filespath}/dualist     ${destroot}${prefix}/bin
    63     reinplace "s|@prefix@|${prefix}|g"       ${destroot}${prefix}/bin/dualist
    64     reinplace "s|@java_home@|${java_home}|g" ${destroot}${prefix}/bin/dualist
     46    # Install the executable script.
     47    xinstall -m 755 ${worksrcpath}/dualist       ${destroot}${prefix}/bin
     48    reinplace "s|run gui|run ${dualist_dir}/gui|g" ${destroot}${prefix}/bin/dualist
     49    reinplace "s|-cp gui|-cp ${dualist_dir}/gui|g" ${destroot}${prefix}/bin/dualist
    6550}
    6651
    67 notes "To try DUALIST, run 'dualist' and open http://localhost:9000/."
     52notes "To try DUALIST, run 'dualist gui' and open http://localhost:8080/."
    6853
    6954post-deactivate {
     
    7863
    7964    post-extract {
    80         xinstall -m 644 -W ${filespath} \
    81             Makefile \
    82             SimpleMecabPipe.java \
    83             ${worksrcpath}
    84         file link -symbolic ${worksrcpath}/lib/mecab.jar ${prefix}/share/java/mecab.jar
     65        copy ${filespath}/SimpleMecabPipe.java ${worksrcpath}/core/src/dualist/pipes
     66        ln -s ${prefix}/share/java/mecab.jar ${worksrcpath}/core/lib/mecab.jar
    8567    }
    8668
    87     post-patch {
    88         reinplace "s|@java_home@|${java_home}|g" ${worksrcpath}/Makefile
    89     }
    90        
    91     build.cmd  make
     69    build.cmd           ant
     70    build.target        main
    9271
    9372    post-destroot {
    94         # Install an extra script for this variant.
    95         xinstall -m 755 ${filespath}/dualist-mecab ${destroot}${prefix}/bin
    96         reinplace "s|@prefix@|${prefix}|g"         ${destroot}${prefix}/bin/dualist-mecab
    97         reinplace "s|@java_home@|${java_home}|g"   ${destroot}${prefix}/bin/dualist-mecab
     73        # Install another executable script using mecab.
     74        xinstall -m 755 ${filespath}/dualist-mecab     ${destroot}${prefix}/bin
     75        reinplace "s|run gui|run ${dualist_dir}/gui|g" ${destroot}${prefix}/bin/dualist-mecab
     76        reinplace "s|-cp gui|-cp ${dualist_dir}/gui|g" ${destroot}${prefix}/bin/dualist-mecab
     77        reinplace "s|@prefix@|${prefix}|g"             ${destroot}${prefix}/bin/dualist-mecab
    9878    }
    9979
    100     notes-append "For Japanese texts, run 'dualist-mecab' instead of 'dualist'."
     80    notes-append "For Japanese texts, run 'dualist-mecab gui' instead of 'dualist gui'."
    10181}
    102 
    103 livecheck.type      regex
    104 livecheck.url       http://code.google.com/p/dualist/downloads/list
    105 livecheck.regex     ${name}-(\[0-9.\]+)\.zip
  • trunk/dports/java/dualist/files/SimpleMecabPipe.java

    r81543 r90590  
    1 package dualist.ja;
     1package dualist.pipes;
    22
    33import cc.mallet.pipe.Pipe;
  • trunk/dports/java/dualist/files/dualist-mecab

    r81620 r90590  
    1 #!/bin/sh
    2 cmd="$1"
    3 if [ -z $cmd ]; then
    4     cmd=run
    5 fi
    6 shift
    7 JAVA_HOME=@java_home@
    8 cd @prefix@/share/java/dualist
    9 @prefix@/bin/play $cmd -Ddualist.lang=ja -Djava.library.path=@prefix@/lib -Dfile.encoding=UTF-8 "$@"
     1#!/usr/bin/env python
     2# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     3# DUALIST command line script
     4
     5import os,sys
     6
     7heapsize = '2000m'
     8
     9mecab_options = ' -Ddualist.lang=ja -Djava.library.path=@prefix@/lib -Dfile.encoding=UTF-8'
     10
     11# display logo
     12print >> sys.stderr, "~ "
     13print >> sys.stderr, "~     __               __ __         __   "
     14print >> sys.stderr, "~ .--|  |.--.--.---.-.|  |__|.-----.|  |_ "
     15print >> sys.stderr, "~ |  _  ||  |  |  _  ||  |  ||__ --||   _|"
     16print >> sys.stderr, "~ |_____||_____|___._||__|__||_____||____|"
     17print >> sys.stderr, "~ "
     18
     19# determine command
     20if len(sys.argv) > 1:
     21    cmd = sys.argv[1]
     22    more_args = sys.argv[2:]
     23else:
     24    cmd = 'none'
     25
     26# run the GUI webapp
     27if cmd == 'gui':
     28    os.system('play run gui -Xmx' + heapsize + mecab_options)
     29    sys.exit(0)
     30
     31# run a standalone classifier from trained model
     32elif cmd == 'classify':
     33    if len(sys.argv) < 4:
     34        print >> sys.stderr, "~ At least two arguments are required:"
     35        print >> sys.stderr, "~     $ dualist classify [model] [documents...]"
     36        print >> sys.stderr, "~"
     37    else:
     38        os.system('java -Xmx' + heapsize + mecab_options + ' -cp gui/lib/dualist-core.jar dualist.tui.Classify ' + ' '.join(more_args))
     39        sys.exit(0)
     40
     41# evaluate a trained classifier on a test set
     42elif cmd == 'test':
     43    if len(sys.argv) < 4:
     44        print >> sys.stderr, "~ Two arguments are required:"
     45        print >> sys.stderr, "~     $ dualist test [model] [test-set]"
     46        print >> sys.stderr, "~"
     47    else:
     48        os.system('java -Xmx' + heapsize + mecab_options + ' -cp gui/lib/dualist-core.jar dualist.tui.Test ' + ' '.join(more_args))
     49        sys.exit(0)
     50
     51# help!
     52else:
     53    print >> sys.stderr, "~ Usage: dualist cmd [args]"
     54    print >> sys.stderr, "~"
     55    print >> sys.stderr, "~    gui          run the web-based annotation interface"
     56    print >> sys.stderr, "~    classify     classify text documents according to a trained model"
     57    print >> sys.stderr, "~    test         evaluate a trained model on a labeled test set"
     58    print >> sys.stderr, "~"
     59    if len(sys.argv) > 1:
     60        print >> sys.stderr, "~ Invalid command: %s" % sys.argv[1]
     61        print >> sys.stderr, "~"
     62    sys.exit(-1)
  • trunk/dports/java/dualist/files/patch-mecab.diff

    r81543 r90590  
    1 --- app/guts/pipes/DocumentPipe.java.orig       2011-05-30 22:31:39.000000000 +0900
    2 +++ app/guts/pipes/DocumentPipe.java    2011-06-30 22:46:50.000000000 +0900
    3 @@ -16,6 +16,8 @@
     1--- core/src/dualist/pipes/DocumentPipe.java.orig       2012-02-11 05:07:28.000000000 +0900
     2+++ core/src/dualist/pipes/DocumentPipe.java    2012-02-22 22:44:45.000000000 +0900
     3@@ -13,6 +13,8 @@
     4 import cc.mallet.pipe.TokenSequenceRemoveStopwords;
    45 import cc.mallet.types.Instance;
    5  import cc.mallet.util.CharSequenceLexer;
    66 
    7 +import dualist.ja.SimpleMecabPipe;
     7+import dualist.pipes.SimpleMecabPipe;
    88+
    99 public class DocumentPipe extends Pipe {
    1010 
    1111     private Pipe myPipe = new SerialPipes(new Pipe[] {
    12 @@ -27,6 +29,9 @@
     12@@ -24,6 +26,9 @@
    1313             new CharSequenceReplace(Pattern.compile("&(.*?);"), ""),
    1414             new CharSequenceReplace(Pattern.compile("[0-9]+"), "00"),
     
    1717+             System.getProperty("dualist.lang").equals("ja")) ?
    1818+            new SimpleMecabPipe() :
    19              new CharSequence2TokenSequence(CharSequenceLexer.LEX_WORD_CLASSES),
     19 //            new CharSequence2TokenSequence(CharSequenceLexer.LEX_WORD_CLASSES),
     20             new CharSequence2TokenSequence("[\\p{L}\\p{Mn}]+"),
    2021             new TokenSequenceRemoveStopwords(),
    21              new TokenSequence2FeatureSequence(),
     22--- build.xml.orig      2012-03-08 23:07:56.000000000 +0900
     23+++ build.xml   2012-03-09 09:32:14.000000000 +0900
     24@@ -26,7 +26,7 @@
     25     <target name="compile">
     26         <mkdir dir="${classes.dir}"/>
     27         <!-- <javac srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/> -->
     28-        <javac debug="true" debuglevel="lines,vars,source" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath"/>
     29+        <javac debug="true" debuglevel="lines,vars,source" srcdir="${src.dir}" destdir="${classes.dir}" classpathref="classpath" encoding="UTF-8"/>
     30     </target>
     31 
     32     <target name="jar" depends="compile">
Note: See TracChangeset for help on using the changeset viewer.