This is an automated email from the ASF dual-hosted git repository. drdub pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/uima-uimacpp.git
The following commit(s) were added to refs/heads/main by this push: new de358a9 Improved ICU handling and dev Docker image de358a9 is described below commit de358a9ae22f8d985be21864f3dcd04ceda04e87 Author: Pablo Duboue <pablo.dub...@gmail.com> AuthorDate: Sat Jul 15 09:27:45 2023 -0400 Improved ICU handling and dev Docker image --- build.Dockerfile | 16 ++++++++++++---- examples/src/ExampleApplication.cpp | 3 +-- examples/src/SofaDataAnnotator.cpp | 5 ++--- examples/src/SofaExampleAnnotator.cpp | 4 ++-- examples/src/SofaExampleApplication.cpp | 3 +-- examples/src/XCasWriterCasConsumer.cpp | 5 ++--- scriptators/python/Makefile | 2 +- src/utils/runAECpp.cpp | 19 +++++++++---------- 8 files changed, 30 insertions(+), 27 deletions(-) diff --git a/build.Dockerfile b/build.Dockerfile index 78ab5e1..8848a34 100644 --- a/build.Dockerfile +++ b/build.Dockerfile @@ -2,7 +2,7 @@ FROM debian:bookworm-slim AS build WORKDIR /uima-cpp -RUN apt-get update && apt-get -y install --no-install-suggests libapr1-dev libxerces-c-dev libicu-dev openjdk-17-jdk-headless build-essential pkgconf autoconf file libtool m4 automake swig4.0 libpython3-dev +RUN apt-get update && apt-get -y install --no-install-suggests libapr1-dev libxerces-c-dev libicu-dev openjdk-17-jdk-headless build-essential pkgconf autoconf file libtool m4 automake swig4.0 libpython3-dev libperl-dev libuima-core-java COPY . . RUN ./autogen.sh RUN mkdir /usr/local/uimacpp @@ -17,12 +17,20 @@ RUN make check # build pythonator RUN echo '/usr/local/uimacpp/lib' >> /etc/ld.so.conf.d/uimacpp.conf && ldconfig -WORKDIR /uima-cpp/scriptators +WORKDIR /uima-cpp/scriptators/python RUN UIMACPP_HOME=/usr/local/uimacpp make -RUN cp libpythonator.so /usr/local/uimacpp/lib/ -RUN cp Pythonator.xml /usr/local/uimacpp/desc/ +RUN cp _pythonnator.so /usr/local/uimacpp/lib; cd /usr/local/uimacpp/scripts; ln -s ../lib/_pythonnator.so . +RUN cd /usr/local/uimacpp/lib; ln -s ../scripts/_pythonnator.so ./libpythonnator.so +RUN cp Pythonnator.xml /usr/local/uimacpp/desc/ RUN cp ae.py pythonnator.py /usr/local/uimacpp/scripts/ +# perltator +WORKDIR /uima-cpp/scriptators/perl +RUN UIMACPP_HOME=/usr/local/uimacpp make +RUN cp perltator.so /usr/local/uimacpp/lib; cd /usr/local/uimacpp/lib; ln -s perltator.so libperltator.so +RUN cp Perltator.xml /usr/local/uimacpp/desc/ +RUN cp ae.pl perltator.pm /usr/local/uimacpp/scripts/ + # dev RUN apt-get install -y --no-install-recommends emacs-nox gdb less ENTRYPOINT ["/bin/bash"] diff --git a/examples/src/ExampleApplication.cpp b/examples/src/ExampleApplication.cpp index 48e0332..b4cc46e 100644 --- a/examples/src/ExampleApplication.cpp +++ b/examples/src/ExampleApplication.cpp @@ -24,7 +24,6 @@ #include <sys/stat.h> using namespace std; -using namespace icu_72; using namespace uima; /** * An example application that reads documents from files, sends them @@ -209,7 +208,7 @@ void processFile (std::string filename, AnalysisEngine * pEngine, CAS * tcas ) { fclose(pFile); /* convert to unicode and set tcas document text*/ - UnicodeString ustrInputText(pBuffer, filesize, "utf-8"); + icu::UnicodeString ustrInputText(pBuffer, filesize, "utf-8"); tcas->setDocumentText(ustrInputText.getBuffer(), ustrInputText.length(), true); diff --git a/examples/src/SofaDataAnnotator.cpp b/examples/src/SofaDataAnnotator.cpp index ff64924..d4a5b6d 100644 --- a/examples/src/SofaDataAnnotator.cpp +++ b/examples/src/SofaDataAnnotator.cpp @@ -19,7 +19,6 @@ #include "uima/api.hpp" using namespace std; -using namespace icu_72; using namespace uima; @@ -94,10 +93,10 @@ public: cout << endl; /** convert to unicode */ - UnicodeString ustrInputText(pBuffer, streamSize+1, "utf-8"); + icu::UnicodeString ustrInputText(pBuffer, streamSize+1, "utf-8"); /** find tokens and annotate */ - UnicodeString delim(" "); + icu::UnicodeString delim(" "); UChar *myLocalSaveState; UChar * pInputText = (UChar*) ustrInputText.getBuffer(); const UChar * pToken = pInputText; diff --git a/examples/src/SofaExampleAnnotator.cpp b/examples/src/SofaExampleAnnotator.cpp index 755e775..94827da 100644 --- a/examples/src/SofaExampleAnnotator.cpp +++ b/examples/src/SofaExampleAnnotator.cpp @@ -19,7 +19,7 @@ #include "uima/api.hpp" using namespace std; -using namespace icu_72; +using namespace icu; using namespace uima; const UChar * translate(UChar *); @@ -28,7 +28,7 @@ class SofaExampleAnnotator : public Annotator { private: Type cross, annot; Feature other; - icu::UnicodeString us_SofaString; + UnicodeString us_SofaString; AnnotatorContext * pAnc; public: diff --git a/examples/src/SofaExampleApplication.cpp b/examples/src/SofaExampleApplication.cpp index abd231e..008130e 100644 --- a/examples/src/SofaExampleApplication.cpp +++ b/examples/src/SofaExampleApplication.cpp @@ -35,7 +35,6 @@ #include "uima/envvars.h" #include "unicode/ucnv.h" using namespace std; -using namespace icu_72; using namespace uima; /* ----------------------------------------------------------------------- */ @@ -90,7 +89,7 @@ int main(int argc, char * argv[]) { CheckError(errorInfo); // Construct a Unicode input string out of our single-byte string. - UnicodeString ustrInputText("This is a text document for analysis"); + icu::UnicodeString ustrInputText("This is a text document for analysis"); if (!runQuiet) cout << "SofaExampleApplication.cpp: document length= " << ustrInputText.length() << endl; diff --git a/examples/src/XCasWriterCasConsumer.cpp b/examples/src/XCasWriterCasConsumer.cpp index 5b02564..0c75e28 100644 --- a/examples/src/XCasWriterCasConsumer.cpp +++ b/examples/src/XCasWriterCasConsumer.cpp @@ -21,14 +21,13 @@ #include "uima/dirwalk.hpp" #include "uima/xmlwriter.hpp" using namespace std; -using namespace icu_72; using namespace uima; class XCasWriterCasConsumer : public Annotator { private: - UnicodeString usOutDir; - std::string strOutDir; + icu::UnicodeString usOutDir; + string strOutDir; bool writeFile; int docnum; diff --git a/scriptators/python/Makefile b/scriptators/python/Makefile index 19c9514..c08d808 100644 --- a/scriptators/python/Makefile +++ b/scriptators/python/Makefile @@ -77,7 +77,7 @@ pythonnator.py uima_wrap.cxx: ../uima.i uimapywrap.h: $(SWIG) -outdir . -c++ -python -external-runtime $@ -pythonnator.o: $(SWIGDEPS) +pythonnator.o: $(SWIGDEPS) pythonnator.cpp $(USER_XTARGET): $(TARGET_FILE).$(DLL_SUFFIX) ln -s $(TARGET_FILE).$(DLL_SUFFIX) $(USER_XTARGET) diff --git a/src/utils/runAECpp.cpp b/src/utils/runAECpp.cpp index 8f9eb17..a65c6ca 100644 --- a/src/utils/runAECpp.cpp +++ b/src/utils/runAECpp.cpp @@ -356,16 +356,15 @@ void process (AnalysisEngine * pEngine, CAS * cas, std::string in, std::string o try { if (xcasInput != textFormat) { /* initialize from an xcas or xmicas */ - //cout << "runAECpp::processing xml file " << in << endl; - XMLCh* native = XMLString::transcode(in.c_str()); - LocalFileInputSource fileIS(native); - XMLString::release(&native); - if (xcasInput == xcasFormat) { - XCASDeserializer::deserialize(fileIS, *cas); - } - else { - XmiDeserializer::deserialize(fileIS, *cas, lenient); - } + // cout << "runAECpp::processing xml file " << in << endl; + XMLCh* native = XMLString::transcode(in.c_str()); + LocalFileInputSource fileIS(native); + XMLString::release(&native); + if (xcasInput == xcasFormat) { + XCASDeserializer::deserialize(fileIS, *cas); + } else { + XmiDeserializer::deserialize(fileIS, *cas, lenient); + } } else { /* read as text file and set document text of default view */ FILE * pFile = fopen(in.c_str(),"rb");