Criado classe extracao para Figuras, Tabelas e Formulas#400
Criado classe extracao para Figuras, Tabelas e Formulas#400samuelveigarangel wants to merge 1 commit intoscieloorg:masterfrom
Conversation
| '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' |
There was a problem hiding this comment.
@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' |
There was a problem hiding this comment.
@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 '} |
There was a problem hiding this comment.
@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' |
|
|
||
| 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', '') |
| foot = extract_node_text(node.xpath('table-wrap-foot')[0]) | ||
| except IndexError: | ||
| foot = '' | ||
| foot = {'wrap-foot': foot} |
There was a problem hiding this comment.
@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 = '' |
There was a problem hiding this comment.
se ausente retornar None
robertatakenaka
left a comment
There was a problem hiding this comment.
@samuelveigarangel verificar os comentários
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.pypython setup.py test -s tests/sps/test_figure.pypython setup.py test -s tests/sps/test_formula.pyAlgum 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"