Reading Superscript and Subscript in .doc file using Apache poi?

Following example shows a way to read superscript/subscript from a docx file. Doc will be similar too.

package demo.poi;import org.apache.poi.openxml4j.exceptions.InvalidFormatException;import org.apache.poi.openxml4j.opc.OPCPackage;import org.apache.poi.xwpf.usermodel.VerticalAlign;import org.apache.poi.xwpf.usermodel.XWPFDocument;import org.apache.poi.xwpf.usermodel.XWPFParagraph;import org.apache.poi.xwpf.usermodel.XWPFRun;import org.junit.Test;import;import;import;import java.util.Iterator;public class DocReaderTest {    @Test    public void showReadDocWithSubscriptAndSuperScript() throws IOException, InvalidFormatException {        File docFile = new File("C:/temp/sample.docx");        XWPFDocument hdoc = new XWPFDocument(OPCPackage.openOrCreate(docFile));        Iterator<XWPFParagraph> paragraphsIterator = hdoc.getParagraphsIterator();        while (paragraphsIterator.hasNext()) {            XWPFParagraph next =;            for (XWPFRun xwrun : next.getRuns()) {                VerticalAlign subscript = xwrun.getSubscript();                String smalltext = xwrun.getText(0);                switch (subscript) {                    case BASELINE:                        System.out.println("smalltext, plain = " + smalltext);                        break;                    case SUBSCRIPT:                        System.out.println("smalltext, subscript = " + smalltext);                        break;                    case SUPERSCRIPT:                        System.out.println("smalltext, superscript = " + smalltext);                        break;                }            }        }    }}

[Solved]: git: 'lfs' is not a git command. See 'git --help'.


$ curl -s | sudo bash
$ sudo apt-get install git-lfs

macOS (Using Homebrew)

$ brew update
$ brew install git-lfs


$ curl -s | sudo bash
sudo apt-get install git-lfs


Use the Windows installer here:

After installing, you can install using:

git lfs install

conda cheat sheet

Command line package and environment manager
Learn to use conda in 30 minutes at
TIP: Anaconda Navigator is a graphical interface to use conda.
Double-click the Navigator icon on your desktop or in a Terminal or at
the Anaconda prompt, type anaconda-navigator
Conda basics
conda is installed, check version number
conda info
Update conda to the current version
conda update conda
Install a package included in Anaconda
conda install PACKAGENAME
Run a package after install, example Spyder*
Update any installed program
conda update PACKAGENAME
Command line help
conda install –help
*Must be installed and have a deployable command,
Using environments
Create a new environment named py35, install Python 3.5
conda create –name py35 python=3.5
Activate the new environment to use it
activate py35
LINUX, macOS: source activate py35
conda env list
Get a list of all my environments, active
environment is shown with *
Make exact copy of an environment
conda create –clone py35 –name py35-2
List all packages and versions installed in active environment
conda list
List the history of each change to the current environment
conda list –revisions
Restore environment to a previous revision
conda install –revision 2
Save environment to a text file
conda list –explicit > bio-env.txt
Delete an environment and everything in it
conda env remove –name bio-env
WINDOWS: deactivate
Deactivate the current environment
macOS, LINUX: source deactivate
Create environment from a text file
conda env create –file bio-env.txt
conda create –name bio-env biopython
Stack commands: create a new environment, name
it bio-env and install the biopython package
Finding conda packages
Use conda to search for a package
conda search PACKAGENAME
See list of all packages in Anaconda
Installing and updating packages
Install a new package (Jupyter Notebook)
conda install jupyter
in the active environment
Run an installed package (Jupyter Notebook)
Install a new package (toolz) in a different environment
conda install –name bio-env toolz
Update a package in the current environment
conda update scikit-learn
Install a package (boltons) from a specific channel
conda install –channel conda-forge
Install a package directly from PyPI into the current active
pip install boltons
environment using pip
Remove one or more packages (toolz, boltons)
conda remove –name bio-env toolz boltons
from a specific environment (bio-env)
Managing multiple versions of Python
conda create –name py34 python=3.4
Install different version of Python in
a new environment named py34
Switch to the new environment that has
activate py34
a different version of Python
Linux, macOS:
source activate py34
Show the locations of all versions of Python that are
where python
currently in the path
Linux, macOS: which -a python
NOTE: The first version of Python in the list will be executed.
Show version information for the current active Python
python –version
Specifying version numbers
Ways to specify a package version number for use with conda create or conda install commands, and in meta.yaml files.
Constraint type
1.11.0, 1.11.1, 1.11.2, 1.11.18 etc.
Greater than or equal to
1.11.0 or higher
1.11.1, 1.11.3
1.8, 1.9, not 2.0
NOTE: Quotation marks must be used when your specification contains a space or any of these characters: > < | *
Free Community Support!forum/conda
Online Documentation
Command Reference
Paid Support Options
Anaconda Onsite Training Courses
Anaconda Consulting Services
Follow us on Twitter @anacondainc and join the #AnacondaCrew!
Connect with other talented, like-minded data scientists and developers while
contributing to the open source movement. Visit · · 512-776-1066
8/20/2017 conda cheat sheet Version 4.3.24

[Solved]: Module 'tensorflow' has no attribute 'contrib'

tf.contrib has moved out of TF starting TF 2.0 alpha.
Take a look at these tf 2.0 release notes

You can upgrade your TF 1.x code to TF 2.x using the tf_upgrade_v2 script

if you want o=to work on older version then you can specify that version with pip

$ pip install tensorflow==1.13.1