Coder Social home page Coder Social logo

Comments (7)

da03 avatar da03 commented on June 1, 2024 1

Hmm I think using python2.7 will solve this, or

try with io.open(file_path_dest,"r",encoding='ascii')?

from im2markup.

da03 avatar da03 commented on June 1, 2024 1

Yes it's the same. You can also found processed data at http://lstm.seas.harvard.edu/latex/data/

from im2markup.

songyuc avatar songyuc commented on June 1, 2024

@da03 , oh, it worked!
Thanks a lot!

from im2markup.

songyuc avatar songyuc commented on June 1, 2024

Hi, @da03 , I want to confirm whether the processing in this repo is the same process in the paper, Image-to-Markup Generation with Coarse-to-Fine Attention?

from im2markup.

songyuc avatar songyuc commented on June 1, 2024

Wow, it is great. I hope to follow your work to do some research.
And I guess, these two .gz files are the same, am I right?
2020-08-27 15-17-33屏幕截图_meitu_1

from im2markup.

TITC avatar TITC commented on June 1, 2024

with io.open(file_path_dest,"r",encoding='ascii')

still not work at python3.7 env

before adjust

    with open(temp_file, 'w') as fout:
        prepre = open(output_file, 'r').read().replace('\r', ' ')  # delete \r
        # replace split, align with aligned
        prepre = re.sub(r'\\begin{(split|align|alignedat|alignat|eqnarray)\*?}(.+?)\\end{\1\*?}',
                        r'\\begin{aligned}\2\\end{aligned}', prepre, flags=re.S)
        prepre = re.sub(r'\\begin{(smallmatrix)\*?}(.+?)\\end{\1\*?}',
                        r'\\begin{matrix}\2\\end{matrix}', prepre, flags=re.S)
        fout.write(prepre)

after adjust

    with open(temp_file, 'w') as fout:
        # prepre = open(output_file, 'r').read().replace('\r', ' ')  # delete \r
        prepre = io.open(output_file, 'r', encoding='ascii').read().replace(
            '\r', ' ')  # delete \r
        # replace split, align with aligned
        prepre = re.sub(r'\\begin{(split|align|alignedat|alignat|eqnarray)\*?}(.+?)\\end{\1\*?}',
                        r'\\begin{aligned}\2\\end{aligned}', prepre, flags=re.S)
        prepre = re.sub(r'\\begin{(smallmatrix)\*?}(.+?)\\end{\1\*?}',
                        r'\\begin{matrix}\2\\end{matrix}', prepre, flags=re.S)
        fout.write(prepre)

show error

2022-04-23 16:52:56,976 root  INFO     Script being executed: preprocess_formulas.py
2022-04-23 16:52:56,976 root  INFO     Script being executed: preprocess_formulas.py
Traceback (most recent call last):
  File "preprocess_formulas.py", line 103, in <module>
    main(sys.argv[1:])
  File "preprocess_formulas.py", line 66, in main
    prepre = io.open(output_file, 'r', encoding='ascii').read().replace(
  File "/home/yhtao/anaconda3/envs/latex_ocr/lib/python3.7/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe7 in position 854136: ordinal not in range(128)

from im2markup.

Yuxiang1995 avatar Yuxiang1995 commented on June 1, 2024

@TITC this work for me io.open(output_file, 'r', encoding='latin-1')

from im2markup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.