-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'fix/validation' into dev
- Loading branch information
Showing
48 changed files
with
712 additions
and
3,482 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,58 @@ | ||
FROM ocrd/core:latest | ||
ENV VERSION="Mi 9. Okt 13:26:16 CEST 2019" | ||
FROM ocrd/core:latest AS base | ||
ENV VERSION="Di 12. Mai 13:26:35 CEST 2020" | ||
ENV GITURL="https://github.com/cisocrgroup" | ||
ENV DOWNLOAD_URL="http://cis.lmu.de/~finkf" | ||
ENV DATA="/apps/ocrd-cis-post-correction" | ||
|
||
# deps | ||
COPY data/docker/deps.txt ${DATA}/deps.txt | ||
RUN apt-get update \ | ||
&& apt-get -y install --no-install-recommends $(cat ${DATA}/deps.txt) | ||
&& apt-get -y install --no-install-recommends locales | ||
|
||
# locales | ||
RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen \ | ||
&& dpkg-reconfigure --frontend=noninteractive locales \ | ||
&& update-locale LANG=en_US.UTF-8 | ||
|
||
# install the profiler | ||
RUN git clone ${GITURL}/Profiler --branch devel --single-branch /tmp/profiler \ | ||
&& cd /tmp/profiler \ | ||
&& mkdir build \ | ||
&& cd build \ | ||
&& cmake -DCMAKE_BUILD_TYPE=release .. \ | ||
&& make compileFBDic trainFrequencyList profiler \ | ||
&& cp bin/compileFBDic bin/trainFrequencyList bin/profiler /apps/ \ | ||
FROM base AS profiler | ||
RUN apt-get update \ | ||
&& apt-get -y install --no-install-recommends cmake g++ libcppunit-dev libxerces-c-dev \ | ||
&& git clone ${GITURL}/Profiler --branch devel --single-branch /build \ | ||
&& cd /build \ | ||
&& cmake -DCMAKE_BUILD_TYPE=release . \ | ||
&& make compileFBDic trainFrequencyList runDictSearch profiler \ | ||
&& mkdir /apps \ | ||
&& cp bin/compileFBDic bin/trainFrequencyList bin/profiler bin/runDictSearch /apps/ \ | ||
&& cd / \ | ||
&& rm -rf /tmp/profiler | ||
&& rm -rf /build | ||
|
||
FROM profiler AS languagemodel | ||
# install the profiler's language backend | ||
RUN git clone ${GITURL}/Resources --branch master --single-branch /tmp/resources \ | ||
&& cd /tmp/resources/lexica \ | ||
&& make FBDIC=/apps/compileFBDic TRAIN=/apps/trainFrequencyList \ | ||
&& mkdir -p /${DATA}/languages \ | ||
&& cp -r german latin greek german.ini latin.ini greek.ini /${DATA}/languages \ | ||
COPY --from=profiler /apps/compileFBDic /apps/ | ||
COPY --from=profiler /apps/trainFrequencyList /apps/ | ||
COPY --from=profiler /apps/runDictSearch /apps/ | ||
RUN apt-get update \ | ||
&& apt-get -y install --no-install-recommends icu-devtools \ | ||
&& git clone ${GITURL}/Resources --branch master --single-branch /build \ | ||
&& cd /build/lexica \ | ||
&& PATH=$PATH:/apps make \ | ||
&& PATH=$PATH:/apps make test \ | ||
&& PATH=$PATH:/apps make install \ | ||
&& cd / \ | ||
&& rm -rf /tmp/resources | ||
&& rm -rf /build | ||
|
||
FROM base AS postcorrection | ||
# install ocrd_cis (python) | ||
COPY Manifest.in Makefile setup.py ocrd-tool.json /tmp/build/ | ||
COPY ocrd_cis/ /tmp/build/ocrd_cis/ | ||
COPY bashlib/ /tmp/build/bashlib/ | ||
# COPY . /tmp/ocrd_cis | ||
RUN cd /tmp/build \ | ||
VOLUME ["/data"] | ||
COPY --from=languagemodel /etc/profiler/languages /etc/profiler/languages | ||
COPY --from=profiler /apps/profiler /apps/ | ||
COPY --from=profiler /usr/lib/x86_64-linux-gnu/libicuuc.so /usr/lib//x86_64-linux-gnu/ | ||
COPY --from=profiler /usr/lib/x86_64-linux-gnu/libicudata.so /usr/lib//x86_64-linux-gnu/ | ||
COPY --from=profiler /usr/lib//x86_64-linux-gnu/libxerces-c-3.2.so /usr/lib//x86_64-linux-gnu/ | ||
COPY . /build | ||
RUN apt-get update \ | ||
&& apt-get -y install --no-install-recommends gcc wget default-jre-headless \ | ||
&& cd /build \ | ||
&& make install \ | ||
&& make test \ | ||
&& cd / \ | ||
&& rm -rf /tmp/build | ||
|
||
# download ocr models and pre-trainded post-correction model | ||
RUN mkdir /apps/models \ | ||
&& cd /apps/models \ | ||
&& wget ${DOWNLOAD_URL}/model.zip >/dev/null 2>&1 \ | ||
&& wget ${DOWNLOAD_URL}/fraktur1-00085000.pyrnn.gz >/dev/null 2>&1 \ | ||
&& wget ${DOWNLOAD_URL}/fraktur2-00062000.pyrnn.gz >/dev/null 2>&1 | ||
|
||
VOLUME ["/data"] | ||
&& rm -rf /build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
PY ?= python3 | ||
PIP ?= pip3 | ||
V ?= > /dev/null 2>&1 | ||
PKG = ocrd_cis | ||
|
||
install: | ||
${PIP} install --upgrade pip . | ||
install-devel: | ||
${PIP} install --upgrade pip -e . | ||
uninstall: | ||
${PIP} uninstall ${PKG} | ||
|
||
docker-build: Dockerfile | ||
docker build -t flobar/ocrd_cis:latest . | ||
docker-push: docker-build | ||
docker push flobar/ocrd_cis:latest | ||
|
||
TEST_SCRIPTS=$(wildcard tests/run_*.sh) | ||
TEST_SCRIPTS=$(sort $(wildcard tests/run_*.bash)) | ||
.PHONY: $(TEST_SCRIPTS) | ||
$(TEST_SCRIPTS): | ||
bash $@ | ||
# run test scripts | ||
bash $@ $V | ||
test: $(TEST_SCRIPTS) | ||
|
||
echo $^ | ||
.PHONY: install test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.