-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yaren.ozyer
committed
Jul 4, 2024
1 parent
60c784e
commit 6a79a83
Showing
6 changed files
with
22,354 additions
and
67 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import re | ||
|
||
def parse_turkish_tweets(text, target, stance, native_tweets, native_targets, native_stances): | ||
cleaned_text = re.sub(r'<ENAMEX TYPE="[^"]+">([^<]+)</ENAMEX>', r'\1', text) | ||
|
||
cleaned_text = re.sub(r'http\S+', '', cleaned_text) | ||
|
||
cleaned_text = re.sub(r'@\S+', '', cleaned_text) | ||
cleaned_text = re.sub(r'#\S+', '', cleaned_text) | ||
|
||
sentences = re.split(r'\s*\n\s*', cleaned_text) | ||
sentences = [sentence for sentence in sentences if sentence] | ||
targets= [target for sentence in sentences if sentence] | ||
stances = [stance for sentence in sentences if sentence] | ||
native_tweets.extend(sentences) | ||
native_targets.extend(targets) | ||
native_stances.extend(stances) |
Oops, something went wrong.