Bizarre string parsing issue in get_part_by_tex()
- Linguagem predominante
- Python
- Estrelas
- 93.9k
- Forks
- 7.7k
- Merge médio
- 2d 13h
- PRs com merge (30d)
- 4
Descrição
There is some kind of substring parsing that I believe is causing unintended behavior. I checked the source for the various substring getting methods and possibly using itertools.chain is causing an issue.
Let's say we have the following TextMobject:
```
wiki = TextMobject("""In statistics, a statistic is sufficient with respect
to a statistical model and its associated unknown parameter
if \"no other statistic that can be
calculated from the same sample provides any
additional information as to the value of the parameter\".""",
substrings_to_isolate=isolate_words
)
```
And we want to manipulate some of these words. All good and well. Here are the words:
```
isolate_words = ["In statistics", "a statistic",
"sufficient",
"statistical model",
"unknown parameter",
"information"]
```
Except that two of these strings are conflicting with each other, leading to a
`AttributeError: 'NoneType' object has no attribute 'copy'`
However if we comment out
`#"a statistic",`
It runs fine.
Or, if we change `"statistical model"` to be `"statisti model"` it also works fine.
I happened to notice in the tex output:
```
Writing "\centering In statistics , a statistic is sufficient with respect
to a statistic al model and its associated unknown parameter if "no other statistic that can be
```
Here statistical has been sliced into `'statistic al'`
Runnable code:
```
from manimlib.imports import *
isolate_words = [ "In statistics", "a statistic",
"sufficient",
"statistical model",
"unknown parameter",
"information"]
wiki = TextMobject("""In statistics, a statistic is sufficient with respect
to a statistical model and its associated unknown parameter
if \"no other statistic that can be
calculated from the same sample provides any
additional information as to the value of the parameter\".""",
substrings_to_isolate=isolate_words
)
language_parts = []
for word in isolate_words:
print(word)
language_parts.append(wiki.get_part_by_tex(word).copy())
```
Guia de contribuição
Nenhum guia de contribuição indexado para este repositório
Avaliação
Esta issue ainda não foi avaliada.