packages: hfst-morph-fi/finnish-analyze.sh (NEW), hfst-morph-fi/hfst-morph-...
qboosh
qboosh at pld-linux.org
Sun May 29 12:02:45 CEST 2011
Author: qboosh Date: Sun May 29 10:02:45 2011 GMT
Module: packages Tag: HEAD
---- Log message:
- new
---- Files affected:
packages/hfst-morph-fi:
finnish-analyze.sh (NONE -> 1.1) (NEW), hfst-morph-fi.spec (NONE -> 1.1) (NEW)
---- Diffs:
================================================================
Index: packages/hfst-morph-fi/finnish-analyze.sh
diff -u /dev/null packages/hfst-morph-fi/finnish-analyze.sh:1.1
--- /dev/null Sun May 29 12:02:45 2011
+++ packages/hfst-morph-fi/finnish-analyze.sh Sun May 29 12:02:36 2011
@@ -0,0 +1,86 @@
+#!/bin/bash
+trdir=/usr/share/hfst/fi
+if [ ! -d "$trdir" ] ; then
+ echo $trdir not found
+ exit 1
+fi
+if [ ! -e "$trdir"/fi-analysis.hfst.ol ] ; then
+ echo "$trdir/fi-analysis.hfst.ol not found"
+ exit 1
+fi
+if [ "$1" == "--help" ] ; then
+ echo Usage: $0 [OUTPUT FORMAT] [FILENAME]
+ exit 0
+fi
+
+# Determine which ways to analyse transducers we have available
+proc_present=1
+cpp_optlookup_present=1
+java_optlookup_present=1
+type hfst-proc > /dev/null 2>/dev/null
+proc_present=$?
+type hfst-optimized-lookup > /dev/null 2>/dev/null
+cpp_optlookup_present=$?
+type java > /dev/null 2> /dev/null
+if [ $? -eq 0 ] ; then
+ java HfstOptimizedLookup > /dev/null 2> /dev/null
+ java_optlookup_present=$?
+fi
+
+if [ $proc_present -eq 0 ] ; then
+ echo 1>&2 Using hfst-proc...
+ if [ $# -lt 1 ] ; then
+ hfst-proc -x "$trdir"/fi-analysis.hfst.ol
+ elif [ $# -lt 2 ] ; then
+ case $1 in
+ cg,CG)
+ hfst-proc --cg "$trdir"/fi-analysis.hfst.ol ;;
+ apertium)
+ hfst-proc --apertium "$trdir"/fi-analysis.hfst.ol ;;
+ xerox)
+ hfst-proc -x "$trdir"/fi-analysis.hfst.ol ;;
+ *)
+ echo Unknown output format $1, using xerox
+ hfst-proc -x "$trdir"/fi-analysis.hfst.ol ;;
+ esac
+ else
+ if [ $# -gt 3 ] ; then
+ echo 1>&2 "Ignoring $3..., for multiple file analysis use cat"
+ fi
+ case $1 in
+ cg,CG)
+ hfst-proc --cg "$trdir"/fi-analysis.hfst.ol $2 ;;
+ apertium)
+ hfst-proc --apertium "$trdir"/fi-analysis.hfst.ol $2 ;;
+ xerox)
+ hfst-proc -x "$trdir"/fi-analysis.hfst.ol $2 ;;
+ *)
+ echo Unknown output format $1, using xerox
+ hfst-proc -x "$trdir"/fi-analysis.hfst.ol $2 ;;
+ esac
+ fi
+elif [ $cpp_optlookup_present -eq 0 ] ; then
+ echo 1>&2 Using hfst-optimized-lookup...
+ if [ $# -lt 1 ] ; then
+ hfst-optimized-lookup "$trdir"/fi-analysis.hfst.ol
+ else
+ if [ $# -gt 3 ] ; then
+ echo 1>&2 "Ignoring $3..., for multiple file analysis use cat"
+ fi
+ hfst-optimized-lookup "$trdir"/fi-analysis.hfst.ol < $2
+ fi
+elif [ $java_optlookup_present -eq 0 ] ; then
+ echo 1>&2 Using hfst-optimized-lookup-java...
+ if [ $# -lt 1 ] ; then
+ java HfstOptimizedLookup "$trdir"/fi-analysis.hfst.ol
+ else
+ if [ $# -gt 3 ] ; then
+ echo 1>&2 "Ignoring $3..., for multiple file analysis use cat"
+ fi
+ java HfstOptimizedLookup "$trdir"/fi-analysis.hfst.ol < $2
+ fi
+else
+ echo "Unable to find analysis utility; tried hfst-proc,"
+ echo "hfst-optimized-lookup and hfst-optimized-lookup-java."
+ exit 1
+fi
================================================================
Index: packages/hfst-morph-fi/hfst-morph-fi.spec
diff -u /dev/null packages/hfst-morph-fi/hfst-morph-fi.spec:1.1
--- /dev/null Sun May 29 12:02:45 2011
+++ packages/hfst-morph-fi/hfst-morph-fi.spec Sun May 29 12:02:36 2011
@@ -0,0 +1,54 @@
+# $Revision$, $Date$
+Summary: HFST morphological analysis transducer for Finnish language
+Summary(pl.UTF-8): Automat HFST do analizy morfologicznej dla języka fińskiego
+Name: hfst-morph-fi
+# or 20110316?
+Version: 0
+Release: 1
+License: GPL v3
+Group: Applications/Text
+# source is at http://gna.org/projects/omorfi
+Source0: http://downloads.sourceforge.net/hfst/hfst-finnish.tar.gz
+# Source0-md5: 0820fc6b25d81efe4ecf2eed41818249
+# modified english-analyze.sh script from hfst-english-installable
+Source1: finnish-analyze.sh
+URL: http://hfst.sourceforge.net/
+Requires: hfst
+BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+This is an Finnish morphological analyser transducer for HFST. The
+analyser comes from Omorfi project: <http://gna.org/projects/omorfi/>.
+
+%description -l pl.UTF-8
+Ten pakiet zawiera automat dla HFST do analizy morfologicznej języka
+fińskiego. Analizator pochodzi z projektu Omorfi:
+<http://gna.org/projects/omorfi/>.
+
+%prep
+%setup -q -n hfst-finnish
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_bindir},%{_datadir}/hfst/fi}
+
+install -p finnish.hfst.olw $RPM_BUILD_ROOT%{_datadir}/hfst/fi/fi-analysis.hfst.ol
+install -p %{SOURCE1} $RPM_BUILD_ROOT%{_bindir}/finnish-analyze.sh
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc README
+%attr(755,root,root) %{_bindir}/finnish-analyze.sh
+%{_datadir}/hfst/fi
+
+%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
+%changelog
+* %{date} PLD Team <feedback at pld-linux.org>
+All persons listed below can be reached at <cvs_login>@pld-linux.org
+
+$Log$
+Revision 1.1 2011/05/29 10:02:36 qboosh
+- new
================================================================
More information about the pld-cvs-commit
mailing list