IBM Wordcloud with the Filter Module
Dear List, I am trying to get the IBM wordcloud java application working with the filter module on MS Windows. This configuration does not create the wordcloud png file. The in and out files "naamloos-10-temp-wordcloud-x.tmp" are actually created. If this configuration correct? Java is installed and I am indicating absolute file locations. Thanks, Jeroen \usemodule[filter] \defineexternalfilter [wordcloud] [filtercommand={/Program Files/Java/jre1.8.0_181/bin/java -jar /context/wordcloud/ibm-word-cloud.jar -c /context/wordcloud/examples/configuration.txt -w 800 -h 600 -o \externalfilteroutputfile\space -i \externalfilterinputfile}, output=\externalfilterbasefile.png, readcommand=\ExternalFigure, continue=yes, purge=no,] \def\ExternalFigure#1{\externalfigure[#1]} \starttext \startwordcloud %[width=100] Thus, I came to the conclusion that the designer of a new system must not only be the implementer and first large||scale user; the designer should also write the first user manual. The separation of any of these four components would have hurt \TeX\ significantly. If I had not participated fully in all these activities, literally hundreds of improvements would never have been made, because I would never have thought of them or perceived why they were important. But a system cannot be successful if it is too strongly influenced by a single person. Once the initial design is complete and fairly robust, the real test begins as people with many different viewpoints undertake their own experiments. \stopwordcloud \stoptext
Can you run the java file from the command promt? Aditya On Mon, 11 Mar 2019, Jeroen wrote:
Dear List,
I am trying to get the IBM wordcloud java application working with the filter module on MS Windows. This configuration does not create the wordcloud png file. The in and out files "naamloos-10-temp-wordcloud-x.tmp" are actually created. If this configuration correct? Java is installed and I am indicating absolute file locations.
Thanks, Jeroen
\usemodule[filter]
\defineexternalfilter
[wordcloud]
[filtercommand={/Program Files/Java/jre1.8.0_181/bin/java
-jar /context/wordcloud/ibm-word-cloud.jar
-c /context/wordcloud/examples/configuration.txt
-w 800
-h 600
-o \externalfilteroutputfile\space
-i \externalfilterinputfile},
output=\externalfilterbasefile.png,
readcommand=\ExternalFigure,
continue=yes,
purge=no,]
\def\ExternalFigure#1{\externalfigure[#1]}
\starttext
\startwordcloud %[width=100]
Thus, I came to the conclusion that the designer of a new
system must not only be the implementer and first
large||scale user; the designer should also write the first
user manual.
The separation of any of these four components would have
hurt \TeX\ significantly. If I had not participated fully in
all these activities, literally hundreds of improvements
would never have been made, because I would never have
thought of them or perceived why they were important.
But a system cannot be successful if it is too strongly
influenced by a single person. Once the initial design is
complete and fairly robust, the real test begins as people
with many different viewpoints undertake their own
experiments.
\stopwordcloud
\stoptext
Yes, there is a batch file for testing purposes, and that one works fine....
Thanks, Jeroen
Op ma 11 mrt. 2019 om 16:55 schreef Aditya Mahajan
Can you run the java file from the command promt?
Aditya
On Mon, 11 Mar 2019, Jeroen wrote:
Dear List,
I am trying to get the IBM wordcloud java application working with the filter module on MS Windows. This configuration does not create the wordcloud png file. The in and out files "naamloos-10-temp-wordcloud-x.tmp" are actually created. If this configuration correct? Java is installed and I am indicating absolute file locations.
Thanks, Jeroen
\usemodule[filter]
\defineexternalfilter
[wordcloud]
[filtercommand={/Program Files/Java/jre1.8.0_181/bin/java
-jar /context/wordcloud/ibm-word-cloud.jar
-c /context/wordcloud/examples/configuration.txt
-w 800
-h 600
-o \externalfilteroutputfile\space
-i \externalfilterinputfile},
output=\externalfilterbasefile.png,
readcommand=\ExternalFigure,
continue=yes,
purge=no,]
\def\ExternalFigure#1{\externalfigure[#1]}
\starttext
\startwordcloud %[width=100]
Thus, I came to the conclusion that the designer of a new
system must not only be the implementer and first
large||scale user; the designer should also write the first
user manual.
The separation of any of these four components would have
hurt \TeX\ significantly. If I had not participated fully in
all these activities, literally hundreds of improvements
would never have been made, because I would never have
thought of them or perceived why they were important.
But a system cannot be successful if it is too strongly
influenced by a single person. Once the initial design is
complete and fairly robust, the real test begins as people
with many different viewpoints undertake their own
experiments.
\stopwordcloud
\stoptext
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net
___________________________________________________________________________________
I am able to run R, asymptote, graphviz, octave, openscad, python and freecad all on the filter module without problems. The same problem as I have with wordcloud I have with maxima and geogebra. \traceexternalfilters isnt giving me a lot. I have tried the following sample1.bat batch file and it seems to create the wc file from the sample text file that comes with wordcloud java -jar /context/wordcloud/ibm-word-cloud.jar -c /context/wordcloud/examples/configuration.txt -w 800 -h 600 < /context/wordcloud/examples/hamlet.txt > /context/documents/sample1.png _______________________________________________________________________________
On Thu, 14 Mar 2019, Jeroen wrote:
I am able to run R, asymptote, graphviz, octave, openscad, python and freecad all on the filter module without problems. The same problem as I have with wordcloud I have with maxima and geogebra. \traceexternalfilters isnt giving me a lot. I have tried the following sample1.bat batch file and it seems to create the wc file from the sample text file that comes with wordcloud
java
-jar /context/wordcloud/ibm-word-cloud.jar
-c /context/wordcloud/examples/configuration.txt
-w 800
-h 600
< /context/wordcloud/examples/hamlet.txt >
/context/documents/sample1.png
Can you attach your test file and the log file? The email program is creating line breaks and I am not sure whether that is there in the original file or not. The only other thing that I can think of is that some executables are not in the path when you are running context (depends a bit on the OS and how context is being run) Aditya
I have installed portable java8 in /context/java, so paths will not be needed when using absolute paths with the commands in these files. When I execute the following batch file sample2.bat with a command on a single line, it will create the sample2.png wordcould file as expected in the /context/documents folder: /context/java/bin/java -jar /context/wordcloud/ibm-word-cloud.jar -c /context/wordcloud/examples/configuration.txt -w 800 -h 600 < /context/wordcloud/examples/hamlet.txt > /context/documents/sample2.png I now use this test2.tex file with filter with the defineexternalfilter command on one line without crlf or spaces: \usemodule[filter] \defineexternalfilter[wordcloud][filtercommand={/context/java/bin/java -jar /context/wordcloud/ibm-word-cloud.jar -c /context/wordcloud/examples/configuration.txt -w 800 -h 600 -o \externalfilteroutputfile\space -i \externalfilterinputfile}, output=\externalfilterbasefile.png, readcommand=\ExternalFigure, continue=yes, read=yes, cache=yes, purge=no,] \def\ExternalFigure#1{\externalfigure[#1]} \traceexternalfilters \starttext \startwordcloud Een bak cijfers vertalen naar een visuele weergave kan ervoor zorgen dat statistische data beter gecommuniceerd wordt. Grafieken zijn zoals Tufte (1997), een bekende auteur op het gebied van analytisch ontwerp, zegt instruments for reasoning. Voordat het zover is zullen echter eerst een paar stappen genomen moeten worden. Ervan uitgaande dat de bak met data al verzameld is moet er gekeken worden welke cijfers met elkaar in verband kunnen worden gebracht. Is er een ontwikkeling in tijd, zijn er verschillen, is er een stijgende of dalende lijn in te ontdekken etcetra. Door deze data te rangschikken en te ordenen kunnen deze patronen zichtbaar gemaakt worden. Ontwikkelingen, schommelingen hierin, de frequentie hiervan, onderlinge relaties en een totaaloverzicht kunnen in beeld gebracht worden. \stopwordcloud \stoptext and the created pdf file states "output file missing", and the following is the test2.log file content: open source > level 1, order 1, name 'C:/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv' system > system > ConTeXt ver: 2018.07.02 14:39 MKIV beta fmt: 2018.9.28 int: english/english system > system > 'cont-new.mkiv' loaded open source > level 2, order 2, name 'C:/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv' system > beware: some patches loaded from cont-new.mkiv close source > level 2, order 2, name 'C:/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv' system > files > jobname 'test2', input './test2', result 'test2' fonts > latin modern fonts are not preloaded languages > language 'en' is active system > synctex functionality is enabled, expect 5-10 pct runtime overhead! open source > level 2, order 3, name 'C:/context/documents/test2.tex' modules > 'filter' is loaded open source > level 3, order 4, name 'C:/context/tex/texmf-modules/tex/context/third/filter/t-filter.mkiv' loading > Filter (ver: 2018.08.10) modules > 'module-catcodes' is loaded open source > level 4, order 5, name 'C:/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.mkiv' loading > Module Catcodes (ver: 2018.04.16) close source > level 4, order 5, name 'C:/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.mkiv' close source > level 3, order 5, name 'C:/context/tex/texmf-modules/tex/context/third/filter/t-filter.mkiv' fonts > preloading latin modern fonts (second stage) fonts > defining > source file 'D:/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf' is not found fonts > defining > using source file 'C:/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf' due to cache mismatch fonts > defining > source file 'D:/context/tex/texmf/fonts/opentype/public/lm-math/latinmodern-math.otf' is not found fonts > defining > using source file 'C:/context/tex/texmf/fonts/opentype/public/lm-math/latinmodern-math.otf' due to cache mismatch fonts > 'fallback modern-designsize rm 12pt' is loaded t-filter > current filter : wordcloud t-filter > base file : test2-temp-wordcloud-0 t-filter > input file : test2-temp-wordcloud-0.tmp t-filter > output file : test2-temp-wordcloud-0.png t-filter > command : /context/java/bin/java -jar /context/wordcloud/ibm-word-cloud.jar -c /context/wordcloud/examples/configuration.txt -w 800 -h 600 -o test2-temp-wordcloud-0.png -i test2-temp-wordcloud-0.tmp t-filter > state : t-filter > cached output file 'test2-temp-wordcloud-0.png' missing. Rerunning filter t-filter > file 'test2-temp-wordcloud-0.png' cannot be found t-filter > current filter : wordcloud t-filter > base file : test2-temp-wordcloud-0 t-filter > input file : test2-temp-wordcloud-0.tmp t-filter > output file : test2-temp-wordcloud-0.png backend > xmp > using file 'C:/context/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml' pages > flushing realpage 1, userpage 1, subpage 1 close source > level 2, order 5, name 'C:/context/documents/test2.tex' close source > level 1, order 5, name 'C:/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv' system > start used files system > text: test2 system > stop used files system > start used files system > 1: filename=char-prv.lua filetype=tex format=tex foundname=C:/context/tex/texmf-context/tex/context/base/mkiv/char-prv.lua fullname=C:/context/tex/texmf-context/tex/context/base/mkiv/char-prv.lua usedmethod=database system > 2: filename=cont-yes.mkiv filetype=tex foundname=C:/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv fullname=C:/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv usedmethod=database system > 3: filename=publ-imp-default.lua filetype=lua foundname=C:/context/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua fullname=C:/context/tex/texmf-context/tex/context/base/mkiv/publ-imp-default.lua usedmethod=database system > 4: filename=cont-new.mkiv filetype=tex foundname=C:/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv fullname=C:/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv usedmethod=database system > 5: filename=lang-exc.lua filetype=lua foundname=C:/context/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua fullname=C:/context/tex/texmf-context/tex/context/base/mkiv/lang-exc.lua usedmethod=database system > 6: filename=lang-us.lua filetype=lua foundname=C:/context/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua fullname=C:/context/tex/texmf-context/tex/context/patterns/mkiv/lang-us.lua usedmethod=database system > 7: filename=C:\context\documents/test2.tex foundname=C:/context/documents/test2.tex fullname=C:/context/documents/test2.tex usedmethod=direct system > 8: filename=t-filter.mkiv filetype=tex foundname=C:/context/tex/texmf-modules/tex/context/third/filter/t-filter.mkiv fullname=C:/context/tex/texmf-modules/tex/context/third/filter/t-filter.mkiv usedmethod=database system > 9: filename=t-module-catcodes.mkiv filetype=tex foundname=C:/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.mkiv fullname=C:/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.mkiv usedmethod=database system > 10: filename=lm.lfg filetype=tex foundname=C:/context/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg fullname=C:/context/tex/texmf-context/tex/context/fonts/mkiv/lm.lfg usedmethod=database system > 11: filename=lmroman12-regular filetype=otf format=otf foundname=C:/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf fullname=C:/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf usedmethod=database system > 12: filename=lmroman12-regular.otf filetype=opentypefonts foundname=C:/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf fullname=C:/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf usedmethod=database system > 13: filename=latinmodern-math.otf filetype=opentypefonts foundname=C:/context/tex/texmf/fonts/opentype/public/lm-math/latinmodern-math.otf fullname=C:/context/tex/texmf/fonts/opentype/public/lm-math/latinmodern-math.otf usedmethod=database system > 14: filename=lmmono12-regular filetype=otf format=otf foundname=C:/context/tex/texmf/fonts/opentype/public/lm/lmmono12-regular.otf fullname=C:/context/tex/texmf/fonts/opentype/public/lm/lmmono12-regular.otf usedmethod=database system > 15: filename=lpdf-pdx.xml filetype=tex foundname=C:/context/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml fullname=C:/context/tex/texmf-context/tex/context/base/mkiv/lpdf-pdx.xml usedmethod=database system > stop used files system > start commandline options system > currentrun="1" system > fulljobname="./test2.tex" system > input="./test2.tex" system > kindofrun="1" system > maxnofruns="9" system > no-parse-first-line="true" system > synctex="true" system > stop commandline options system > start commandline files system > 1: ./test2.tex system > stop commandline files modules > start used modules modules > loaded : *-filter modules > loaded : *-module-catcodes modules > stop used modules mkiv lua stats > used config file: selfautoparent:/texmf/web2c/texmfcnf.lua mkiv lua stats > used cache path: C:/context/tex/texmf-cache/luatex-cache/context/5fe67e0bfe781ce0dde776fb1556f32e mkiv lua stats > resource resolver: loadtime 0.011 seconds, 0 scans with scantime 0.000 seconds, 0 shared scans, 15 found files, scanned paths: <none> mkiv lua stats > stored bytecode data: 424 modules (0.464 sec), 93 tables (0.030 sec), 517 chunks (0.494 sec) mkiv lua stats > traced context: maxstack: 1303, freed: 0, unreachable: 1303 mkiv lua stats > cleaned up reserved nodes: 59 nodes, 9 lists of 455 mkiv lua stats > node memory usage: 2 glue, 2 kern, 2 penalty, 11 attribute, 50 glue_spec, 4 attribute_list, 2 temp, 2 user_defined mkiv lua stats > node list callback tasks: 7 unique task lists, 6 instances (re)created, 34 calls mkiv lua stats > synctex tracing: 2 referenced files, 7 files ignored, 3 objects flushed, logfile: test2.synctex mkiv lua stats > used backend: pdf (backend for directly generating pdf output) mkiv lua stats > jobdata time: 0.003 seconds saving, 0.000 seconds loading mkiv lua stats > callbacks: internal: 222, file: 776, direct: 8, late: 1, function 601, total: 1608 mkiv lua stats > randomizer: resumed with value 0.94168090820313 mkiv lua stats > loaded tex modules: 2 requested, all found (*-filter *-module-catcodes) mkiv lua stats > loaded patterns: en::2, load time: 0.000 mkiv lua stats > result saved in file: test2.pdf, compresslevel 3, objectcompresslevel 3 mkiv lua stats > loaded fonts: 3 files: latinmodern-math.otf, lmmono12-regular.otf, lmroman12-regular.otf mkiv lua stats > font engine: otf 3.103, afm 1.513, tfm 1.000, 8 instances, 3 shared in backend, 3 common vectors, 0 common hashes, load time 0.487 seconds mkiv lua stats > used platform: win64, type: windows, binary subtree: texmf-win64 mkiv lua stats > used engine: luatex version 1.09 with functionality level 6930, banner: this is luatex, version 1.09.0 (tex live 2018/w32tex) mkiv lua stats > control sequences: 45247 of 65536 + 100000 mkiv lua stats > lua properties: engine: lua 5.3, used memory: 100 MB (ctx: 100 MB), hash type: lua, hash chars: min(32,40), symbol mask: utf (τεχ) mkiv lua stats > runtime: 1.472 seconds, 1 processed pages, 1 shipped pages, 0.679 pages/second
On Fri, 15 Mar 2019, Jeroen wrote:
I have installed portable java8 in /context/java, so paths will not be needed when using absolute paths with the commands in these files. When I execute the following batch file sample2.bat with a command on a single line, it will create the sample2.png wordcould file as expected in the /context/documents folder:
/context/java/bin/java -jar /context/wordcloud/ibm-word-cloud.jar -c /context/wordcloud/examples/configuration.txt -w 800 -h 600 < /context/wordcloud/examples/hamlet.txt > /context/documents/sample2.png
I now use this test2.tex file with filter with the defineexternalfilter command on one line without crlf or spaces:
fonts > 'fallback modern-designsize rm 12pt' is loaded t-filter > current filter : wordcloud t-filter > base file : test2-temp-wordcloud-0 t-filter > input file : test2-temp-wordcloud-0.tmp t-filter > output file : test2-temp-wordcloud-0.png t-filter > command : /context/java/bin/java -jar /context/wordcloud/ibm-word-cloud.jar -c /context/wordcloud/examples/configuration.txt -w 800 -h 600 -o test2-temp-wordcloud-0.png -i test2-temp-wordcloud-0.tmp t-filter > state : t-filter > cached output file 'test2-temp-wordcloud-0.png' missing. Rerunning filter t-filter > file 'test2-temp-wordcloud-0.png' cannot be found t-filter > current filter : wordcloud t-filter > base file : test2-temp-wordcloud-0 t-filter > input file : test2-temp-wordcloud-0.tmp t-filter > output file : test2-temp-wordcloud-0.png
Everything looks okay here, so I am not sure what is going wrong. Can you try if you can run other java programs, perhaps even setting \usemodule[filter] \traceexternalfilters \defineexternalfilter[JAVA][filtercommand=java] \starttext \startJAVA This is a test \stopJAVA \stoptext and check the console output to see if you see messages that java is running (you should see the standard message about how to use java). If java is being called correctly, then the error is on the java end of things and I don't know how to debug that. Aditya
participants (2)
-
Aditya Mahajan
-
Jeroen