File size: 2,838 Bytes
1dafcd7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import pandas as pd

# File path to the input CSV file
input_file_path = '../original_data/data.csv'
# Output file path
output_file_path = 'top_50_urdu.json'

# Load the CSV file into a Pandas DataFrame
df = pd.read_csv(input_file_path, encoding='utf-8')


# count the number of rows
num_rows = df.shape[0]
print(f"Number of rows: {num_rows}")

# Count the number of rows where both column values are the same
same_values_count = df[df['Urdu text'] == df['Roman-Urdu text']].shape[0]
print(f"Number of rows where both column values are the same: {same_values_count}")

# count the number of rows where both column values are different
different_values_count = df[df['Urdu text'] != df['Roman-Urdu text']].shape[0]
print(f"Number of rows where both column values are different: {different_values_count}")

# count the number of unique Urdu sentences
unique_urdu_sentences = df['Urdu text'].nunique()
print(f"Number of unique Urdu sentences: {unique_urdu_sentences}")

# count the number of unique Roman-Urdu sentences
unique_roman_urdu_sentences = df['Roman-Urdu text'].nunique()
print(f"Number of unique Roman-Urdu sentences: {unique_roman_urdu_sentences}")

# count the number of rows where the Urdu and Roman-Urdu sentences do not appear anywhere else together
unique_pairs = df.groupby(['Urdu text', 'Roman-Urdu text']).size().reset_index(name='count')
unique_pairs = unique_pairs[unique_pairs['count'] == 1].shape[0]
print(f"Number of rows where the combination occurs only once in the whole dataset: {unique_pairs}")

# count the number of unique pairs of Urdu and Roman-Urdu sentences
unique_pairs = df.drop_duplicates().shape[0]
print(f"Number of unique pairs of Urdu and Roman-Urdu sentences: {unique_pairs}")


# count the number of rows where the Urdu sentence appears only once in the dataset
urdu_sentence_counts = df['Urdu text'].value_counts()
urdu_sentence_counts = urdu_sentence_counts[urdu_sentence_counts == 1].shape[0]
print(f"Number of rows where the Urdu sentence appears only once in the dataset: {urdu_sentence_counts}")

# count the number of rows where the Roman-Urdu sentence appears only once in the dataset
roman_urdu_sentence_counts = df['Roman-Urdu text'].value_counts()
roman_urdu_sentence_counts = roman_urdu_sentence_counts[roman_urdu_sentence_counts == 1].shape[0]
print(f"Number of rows where the Roman-Urdu sentence appears only once in the dataset: {roman_urdu_sentence_counts}")


# count the number of where the urdu sentences appear more than once but less than 11 times in the whole dataset
urdu_sentence_counts = df['Urdu text'].value_counts()
urdu_sentence_counts = urdu_sentence_counts[(urdu_sentence_counts > 1) & (urdu_sentence_counts <= 10)].shape[0]
print(f"Number of rows where the Urdu sentence appears more than once but less than 11 times in the whole dataset: {urdu_sentence_counts}")