Bizarre string parsing issue in get_part_by_tex()
- 主要言語
- Python
- スター
- 93.9k
- フォーク
- 7.7k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 4
説明
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())
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
評価
この issue はまだ評価されていません。