Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Criado classe extracao para Figuras, Tabelas e Formulas #400

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

samuelveigarangel
Copy link
Collaborator

O que esse PR faz?

Adiciona classes de extracao para figuras, tabelas e formulas.

Onde a revisão poderia começar?

Pelo Commit

Como este poderia ser testado manualmente?

python setup.py test -s tests/sps/test_table.py
python setup.py test -s tests/sps/test_figure.py
python setup.py test -s tests/sps/test_formula.py

Algum cenário de contexto que queira dar?

N/A

Screenshots

N/A

Quais são tickets relevantes?

#393

Referências

SciElo Docs "disp-formula"
SicElo Docs "table"
SciElo Docs "fig"

'id': 't01',
'label': 'Table. ',
'title': 'Proportion of correct HIV/AIDS knowledge responses as reported by the men who have sex with men, the difficulty and discrimination parameters for each item, estimated by Item Response Theory. Brazil, 2008-2009. (N = 3,746)',
'table': '<colgroup width="25%"><col width="60%"/><col width="10%"/><col width="10%"/><col width="10%"/></colgroup><thead><tr><th style="font-weight:normal" align="left">Item</th><th style="font-weight:normal">% Correct response</th><th style="font-weight:normal">Difficulty (<italic>b</italic>\n <sub><italic>i</italic></sub>)</th><th style="font-weight:normal">Discrimination (<italic>a</italic>\n <sub><italic>i</italic></sub>)</th></tr></thead><tbody><tr><td>1. The risk of transmitting HIV is small if one follows the treatment correctly.</td><td align="center">35.5</td><td align="center">14.45</td><td align="center">0.04</td></tr><tr><td>2. People are using less condoms because of AIDS treatment.</td><td align="center">34.5</td><td align="center">14.23</td><td align="center">0.04</td></tr><tr><td>3. A person can get the AIDS virus by using public toilets.</td><td align="center">78.1</td><td align="center">3.72</td><td align="center">0.95</td></tr><tr><td>4. A person can get the AIDS virus through insect bites.</td><td align="center">75.5</td><td align="center">3.70</td><td align="center">0.72</td></tr><tr><td>5. A person can become infected by sharing eating utensils, cups or food.</td><td align="center">85.7</td><td align="center">3.28</td><td align="center">1.01</td></tr><tr><td>6. The risk of HIV + mothers infecting their babies is small if she receives treatment in pregnancy and childbirth.</td><td align="center">75.8</td><td align="center">2.70</td><td align="center">0.32</td></tr><tr><td>7. The risk of HIV infection can be reduced if you have relations only with an uninfected partner.</td><td align="center">72.6</td><td align="center">2.03</td><td align="center">0.20</td></tr><tr><td>8. A healthy person can be infected with the AIDS virus.</td><td align="center">94.1</td><td align="center">1.61</td><td align="center">0.59</td></tr><tr><td>9. A person can get the virus from sharing a syringe or needle.</td><td align="center">96.9</td><td align="center">1.51</td><td align="center">0.78</td></tr><tr><td>10. Anyone can get the AIDS virus if condoms are not used.</td><td align="center">98.5</td><td align="center">1.27</td><td align="center">0.95</td></tr></tbody>', 'wrap-foot': 'bi: Difficulty parameter of each item; ai: Discrimination parameter of each item'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuelveigarangel <table> deve estar presente no conteúdo de 'table'. Não é redundante pois talvez o table possa ter atributos.

'id': 'fg-13',
'title': 'View B: From the Side, Best Profile',
'label': 'b.',
'graphic': 'sideView.png'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuelveigarangel em <graphic> há outros atributos além de xref:href, e deveriam ser representados no dicionário. Veja aqueles que fig contém alternatives

'disp_formula_label': '(1)',
'equation': {
'id': 'tx1',
'eq': '\n \\documentclass {article}\n \\usepackage{wasysym}\n \\usepackage[substack]{amsmath}\n \\usepackage{amsfonts}\n \\usepackage{amssymb}\n \\usepackage{amsbsy}\n \\usepackage[mathscr]{eucal}\n \\usepackage{mathrsfs}\n \\usepackage{pmc}\n \\usepackage[Euler]{upgreek}\n \\pagestyle{empty}\n \\oddsidemargin -1.0in\n \\begin{document}\n \\[E_it=α_i+Z_it γ+W_it δ+C_it θ+∑_i^n EFind_i+∑_t^n EFtemp_t+ ε_it \\]\n \\end{document}\n '}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuelveigarangel no lugar de eq, use tex-math e mml, desta forma o usuário da classe saberá o tipo do conteúdo

eq_graphic = eq_node.get('{http://www.w3.org/1999/xlink}href')
eq_dict = {'id': eq_node_id, 'graphic': eq_graphic}
return eq_dict
return 'Not found formulas'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuelveigarangel retornar None


if node.xpath(math_node_xpath, namespaces=mnl_namespace) or node.xpath(tex_math_xpath):
eq_node = node.xpath(math_node_xpath, namespaces=mnl_namespace) or node.xpath(tex_math_xpath)
eq_node_id = eq_node[0].get('id', '')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuelveigarangel na ausência de dados, usar None

foot = extract_node_text(node.xpath('table-wrap-foot')[0])
except IndexError:
foot = ''
foot = {'wrap-foot': foot}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuelveigarangel usar table-wrap-foot no lugar de apenas wrap-foot

try:
foot = extract_node_text(node.xpath('table-wrap-foot')[0])
except IndexError:
foot = ''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

se ausente retornar None

Copy link
Member

@robertatakenaka robertatakenaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@samuelveigarangel verificar os comentários

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants