iamramzan commited on
Commit
da917d7
·
verified ·
1 Parent(s): 7b418f8

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +34 -0
README.md CHANGED
@@ -72,6 +72,40 @@ Contributions are welcome! If you spot an issue or have suggestions for improvem
72
  2. Make your changes.
73
  3. Submit a pull request.
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  ## Usage
76
 
77
  ### Loading the Dataset in Python
 
72
  2. Make your changes.
73
  3. Submit a pull request.
74
 
75
+ ## Who are the source Data producers ?
76
+ The data is machine-generated (using web scraping) and subjected to human additional treatment.
77
+
78
+ below, I provide the script I created to scrape the data (as well as my additional treatment):
79
+
80
+ import scrapy
81
+
82
+
83
+ class StatesspiderSpider(scrapy.Spider):
84
+ name = 'statesspider'
85
+ start_urls = ['https://en.wikipedia.org/wiki/List_of_sovereign_states']
86
+
87
+ def parse(self, response):
88
+ rows = response.xpath('//table[contains(@class, "wikitable")][1]//tr') # Locate the main table
89
+
90
+ for row in rows[1:]: # Skip the header row
91
+ common_and_formal_names = row.xpath('td[1]//text()').getall() # First column
92
+ membership_within_un_system = row.xpath('td[2]//text()').getall() # Second column
93
+ sovereignty_dispute = row.xpath('td[3]//text()').getall() # Third column
94
+ further_information = row.xpath('td[4]//text()').getall() # Fourth column
95
+
96
+ # Clean up and join text lists
97
+ common_and_formal_names = ' '.join(common_and_formal_names).strip()
98
+ membership_within_un_system = ' '.join(membership_within_un_system).strip()
99
+ sovereignty_dispute = ' '.join(sovereignty_dispute).strip()
100
+ further_information = ' '.join(further_information).strip()
101
+
102
+ yield {
103
+ 'Common and Formal Names': common_and_formal_names,
104
+ 'Membership within the UN System': membership_within_un_system,
105
+ 'Sovereignty Dispute': sovereignty_dispute,
106
+ 'Further Information': further_information,
107
+ }
108
+
109
  ## Usage
110
 
111
  ### Loading the Dataset in Python