| 376 | } |
| 377 | |
| 378 | inline void SubtitleItem::extractInfo(bool keepHTML, bool doNotIgnoreNonDialogues, bool doNotRemoveSpeakerNames) //process subtitle |
| 379 | { |
| 380 | std::string output = _text; |
| 381 | |
| 382 | //stripping HTML tags |
| 383 | if(!keepHTML) |
| 384 | { |
| 385 | /* |
| 386 | * TODO : Before erasing, extract the words. |
| 387 | * std::vector<std::string> getStyleTags(); |
| 388 | * int getStyleTagCount() const; |
| 389 | * std::vector<std::string> _styleTag; |
| 390 | * int _styleTagCount; |
| 391 | */ |
| 392 | |
| 393 | int countP = 0; |
| 394 | for(char& c : output) // replacing <...> with ~~~~ |
| 395 | { |
| 396 | if(c=='<') |
| 397 | { |
| 398 | countP++; |
| 399 | c = '~'; |
| 400 | } |
| 401 | |
| 402 | else |
| 403 | { |
| 404 | if(countP!=0) |
| 405 | { |
| 406 | if(c != '>') |
| 407 | c = '~'; |
| 408 | |
| 409 | else if(c == '>') |
| 410 | { |
| 411 | c = '~'; |
| 412 | countP--; |
| 413 | } |
| 414 | } |
| 415 | } |
| 416 | } |
| 417 | } |
| 418 | |
| 419 | //stripping non dialogue data e.g. (applause) |
| 420 | |
| 421 | if(!doNotIgnoreNonDialogues) |
| 422 | { |
| 423 | /* |
| 424 | * TODO : Before erasing, extract the words. |
| 425 | * std::vector<std::string> getNonDialogueWords(); |
| 426 | * int getNonDialogueCount() const; |
| 427 | * std::vector<std::string> _nonDialogue; |
| 428 | * int _nonDialogueCount; |
| 429 | */ |
| 430 | |
| 431 | int countP = 0; |
| 432 | for(char& c : output) // replacing (...) with ~~~~ |
| 433 | { |
| 434 | if(c=='(') |
| 435 | { |