GeoParser 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/GeoParser.rb +261 -12
- data/test/test_geoParser.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b67d7df669c1229a008afb69ebed5aa31fd739c
|
4
|
+
data.tar.gz: ae9da41ca1960b1e7725aff8781892f7e17a5ba6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a2ed08dec1a211c985423b24bd16676a8267f957d763acdf5c034ae0dea7bb0cbb19ed747bf02a3ee564e9dae57ef2f77d46d87a3f7536226b9da23adf92238
|
7
|
+
data.tar.gz: 1950671e7930d328c014acb1c63f24cc04dc95e0b3ff75c09debf6f55d762c6bb88ea4eeff3b0d73ee4975f88f24d9a9c53adfff022d1ce56ce63b67a30edb6a
|
data/lib/GeoParser.rb
CHANGED
@@ -5,7 +5,7 @@ class GeoParser
|
|
5
5
|
|
6
6
|
def self.getLocation(string)
|
7
7
|
words = string.split(/\W+/)
|
8
|
-
|
8
|
+
cityArray = []
|
9
9
|
|
10
10
|
cities = Hash[
|
11
11
|
|
@@ -598,19 +598,268 @@ class GeoParser
|
|
598
598
|
"Al-Hudaydah"=>"Al-Hudaydah",
|
599
599
|
"Sana'a'"=>"Sana'a'",
|
600
600
|
"Ta'izz"=>"Ta'izz",
|
601
|
-
"Lusaka"=>"Lusaka"
|
601
|
+
"Lusaka"=>"Lusaka",
|
602
|
+
"Afghanistan"=>"Afghanistan",
|
603
|
+
"Albania"=>"Albania",
|
604
|
+
"Algeria"=>"Algeria",
|
605
|
+
"American Samoa"=>"American Samoa",
|
606
|
+
"Andorra"=>"Andorra",
|
607
|
+
"Angola"=>"Angola",
|
608
|
+
"Anguilla"=>"Anguilla",
|
609
|
+
"Antarctica"=>"Antarctica",
|
610
|
+
"Antigua and Barbuda"=>"Antigua and Barbuda",
|
611
|
+
"Argentina"=>"Argentina",
|
612
|
+
"Armenia"=>"Armenia",
|
613
|
+
"Armenia"=>"Armenia",
|
614
|
+
"Aruba"=>"Aruba",
|
615
|
+
"Australia"=>"Australia",
|
616
|
+
"Austria"=>"Austria",
|
617
|
+
"Azerbaijan"=>"Azerbaijan",
|
618
|
+
"Azerbaijan"=>"Azerbaijan",
|
619
|
+
"Bahamas"=>"Bahamas",
|
620
|
+
"Bahrain"=>"Bahrain",
|
621
|
+
"Bangladesh"=>"Bangladesh",
|
622
|
+
"Barbados"=>"Barbados",
|
623
|
+
"Belarus"=>"Belarus",
|
624
|
+
"Belgium"=>"Belgium",
|
625
|
+
"Belize"=>"Belize",
|
626
|
+
"Benin"=>"Benin",
|
627
|
+
"Bermuda"=>"Bermuda",
|
628
|
+
"Bhutan"=>"Bhutan",
|
629
|
+
"Bolivia"=>"Bolivia",
|
630
|
+
"Bosnia and Herzegovina"=>"Bosnia and Herzegovina",
|
631
|
+
"Botswana"=>"Botswana",
|
632
|
+
"Bouvet Island"=>"Bouvet Island",
|
633
|
+
"Brazil"=>"Brazil",
|
634
|
+
"British Indian Ocean Territory"=>"British Indian Ocean Territory",
|
635
|
+
"Brunei Darussalam"=>"Brunei Darussalam",
|
636
|
+
"Bulgaria"=>"Bulgaria",
|
637
|
+
"Burkina Faso"=>"Burkina Faso",
|
638
|
+
"Burundi"=>"Burundi",
|
639
|
+
"Cambodia"=>"Cambodia",
|
640
|
+
"Cameroon"=>"Cameroon",
|
641
|
+
"Canada"=>"Canada",
|
642
|
+
"Cape Verde"=>"Cape Verde",
|
643
|
+
"Cayman Islands"=>"Cayman Islands",
|
644
|
+
"Central African Republic"=>"Central African Republic",
|
645
|
+
"Chad"=>"Chad",
|
646
|
+
"Chile"=>"Chile",
|
647
|
+
"China"=>"China",
|
648
|
+
"Christmas Island"=>"Christmas Island",
|
649
|
+
"Cocos (Keeling) Islands"=>"Cocos (Keeling) Islands",
|
650
|
+
"Colombia"=>"Colombia",
|
651
|
+
"Comoros"=>"Comoros",
|
652
|
+
"Congo"=>"Congo",
|
653
|
+
"Congo, The Democratic Republic of The"=>"Congo, The Democratic Republic of The",
|
654
|
+
"Cook Islands"=>"Cook Islands",
|
655
|
+
"Costa Rica"=>"Costa Rica",
|
656
|
+
"Cote D'ivoire"=>"Cote D'ivoire",
|
657
|
+
"Croatia"=>"Croatia",
|
658
|
+
"Cuba"=>"Cuba",
|
659
|
+
"Cyprus"=>"Cyprus",
|
660
|
+
"Czech Republic"=>"Czech Republic",
|
661
|
+
"Denmark"=>"Denmark",
|
662
|
+
"Djibouti"=>"Djibouti",
|
663
|
+
"Dominica"=>"Dominica",
|
664
|
+
"Dominican Republic"=>"Dominican Republic",
|
665
|
+
"Easter Island"=>"Easter Island",
|
666
|
+
"Ecuador"=>"Ecuador",
|
667
|
+
"Egypt"=>"Egypt",
|
668
|
+
"El Salvador"=>"El Salvador",
|
669
|
+
"Equatorial Guinea"=>"Equatorial Guinea",
|
670
|
+
"Eritrea"=>"Eritrea",
|
671
|
+
"Estonia"=>"Estonia",
|
672
|
+
"Ethiopia"=>"Ethiopia",
|
673
|
+
"Falkland Islands (Malvinas)"=>"Falkland Islands (Malvinas)",
|
674
|
+
"Faroe Islands"=>"Faroe Islands",
|
675
|
+
"Fiji"=>"Fiji",
|
676
|
+
"Finland"=>"Finland",
|
677
|
+
"France"=>"France",
|
678
|
+
"French Guiana"=>"French Guiana",
|
679
|
+
"French Polynesia"=>"French Polynesia",
|
680
|
+
"French Southern Territories"=>"French Southern Territories",
|
681
|
+
"Gabon"=>"Gabon",
|
682
|
+
"Gambia"=>"Gambia",
|
683
|
+
"Georgia"=>"Georgia",
|
684
|
+
"Germany"=>"Germany",
|
685
|
+
"Ghana"=>"Ghana",
|
686
|
+
"Gibraltar"=>"Gibraltar",
|
687
|
+
"Greece"=>"Greece",
|
688
|
+
"Greenland"=>"Greenland",
|
689
|
+
"Grenada"=>"Grenada",
|
690
|
+
"Guadeloupe"=>"Guadeloupe",
|
691
|
+
"Guam"=>"Guam",
|
692
|
+
"Guatemala"=>"Guatemala",
|
693
|
+
"Guinea"=>"Guinea",
|
694
|
+
"Guinea-bissau"=>"Guinea-bissau",
|
695
|
+
"Guyana"=>"Guyana",
|
696
|
+
"Haiti"=>"Haiti",
|
697
|
+
"Heard Island and Mcdonald Islands"=>"Heard Island and Mcdonald Islands",
|
698
|
+
"Honduras"=>"Honduras",
|
699
|
+
"Hong Kong"=>"Hong Kong",
|
700
|
+
"Hungary"=>"Hungary",
|
701
|
+
"Iceland"=>"Iceland",
|
702
|
+
"India"=>"India",
|
703
|
+
"Indonesia"=>"Indonesia",
|
704
|
+
"Indonesia"=>"Indonesia",
|
705
|
+
"Iran"=>"Iran",
|
706
|
+
"Iraq"=>"Iraq",
|
707
|
+
"Ireland"=>"Ireland",
|
708
|
+
"Israel"=>"Israel",
|
709
|
+
"Italy"=>"Italy",
|
710
|
+
"Jamaica"=>"Jamaica",
|
711
|
+
"Japan"=>"Japan",
|
712
|
+
"Jordan"=>"Jordan",
|
713
|
+
"Kazakhstan"=>"Kazakhstan",
|
714
|
+
"Kazakhstan"=>"Kazakhstan",
|
715
|
+
"Kenya"=>"Kenya",
|
716
|
+
"Kiribati"=>"Kiribati",
|
717
|
+
"Korea North"=>"Korea North",
|
718
|
+
"Korea South"=>"Korea South",
|
719
|
+
"Kosovo"=>"Kosovo",
|
720
|
+
"Kuwait"=>"Kuwait",
|
721
|
+
"Kyrgyzstan"=>"Kyrgyzstan",
|
722
|
+
"Laos"=>"Laos",
|
723
|
+
"Latvia"=>"Latvia",
|
724
|
+
"Lebanon"=>"Lebanon",
|
725
|
+
"Lesotho"=>"Lesotho",
|
726
|
+
"Liberia"=>"Liberia",
|
727
|
+
"Libyan Arab Jamahiriya"=>"Libyan Arab Jamahiriya",
|
728
|
+
"Liechtenstein"=>"Liechtenstein",
|
729
|
+
"Lithuania"=>"Lithuania",
|
730
|
+
"Luxembourg"=>"Luxembourg",
|
731
|
+
"Macau"=>"Macau",
|
732
|
+
"Macedonia"=>"Macedonia",
|
733
|
+
"Madagascar"=>"Madagascar",
|
734
|
+
"Malawi"=>"Malawi",
|
735
|
+
"Malaysia"=>"Malaysia",
|
736
|
+
"Maldives"=>"Maldives",
|
737
|
+
"Mali"=>"Mali",
|
738
|
+
"Malta"=>"Malta",
|
739
|
+
"Marshall Islands"=>"Marshall Islands",
|
740
|
+
"Martinique"=>"Martinique",
|
741
|
+
"Mauritania"=>"Mauritania",
|
742
|
+
"Mauritius"=>"Mauritius",
|
743
|
+
"Mayotte"=>"Mayotte",
|
744
|
+
"Mexico"=>"Mexico",
|
745
|
+
"Micronesia, Federated States of"=>"Micronesia, Federated States of",
|
746
|
+
"Moldova, Republic of"=>"Moldova, Republic of",
|
747
|
+
"Monaco"=>"Monaco",
|
748
|
+
"Mongolia"=>"Mongolia",
|
749
|
+
"Montenegro"=>"Montenegro",
|
750
|
+
"Montserrat"=>"Montserrat",
|
751
|
+
"Morocco"=>"Morocco",
|
752
|
+
"Mozambique"=>"Mozambique",
|
753
|
+
"Myanmar"=>"Myanmar",
|
754
|
+
"Namibia"=>"Namibia",
|
755
|
+
"Nauru"=>"Nauru",
|
756
|
+
"Nepal"=>"Nepal",
|
757
|
+
"Netherlands"=>"Netherlands",
|
758
|
+
"Netherlands Antilles"=>"Netherlands Antilles",
|
759
|
+
"New Caledonia"=>"New Caledonia",
|
760
|
+
"New Zealand"=>"New Zealand",
|
761
|
+
"Nicaragua"=>"Nicaragua",
|
762
|
+
"Niger"=>"Niger",
|
763
|
+
"Nigeria"=>"Nigeria",
|
764
|
+
"Niue"=>"Niue",
|
765
|
+
"Norfolk Island"=>"Norfolk Island",
|
766
|
+
"Northern Mariana Islands"=>"Northern Mariana Islands",
|
767
|
+
"Norway"=>"Norway",
|
768
|
+
"Oman"=>"Oman",
|
769
|
+
"Pakistan"=>"Pakistan",
|
770
|
+
"Palau"=>"Palau",
|
771
|
+
"Palestinian Territory"=>"Palestinian Territory",
|
772
|
+
"Panama"=>"Panama",
|
773
|
+
"Papua New Guinea"=>"Papua New Guinea",
|
774
|
+
"Paraguay"=>"Paraguay",
|
775
|
+
"Peru"=>"Peru",
|
776
|
+
"Philippines"=>"Philippines",
|
777
|
+
"Pitcairn"=>"Pitcairn",
|
778
|
+
"Poland"=>"Poland",
|
779
|
+
"Portugal"=>"Portugal",
|
780
|
+
"Puerto Rico"=>"Puerto Rico",
|
781
|
+
"Qatar"=>"Qatar",
|
782
|
+
"Reunion"=>"Reunion",
|
783
|
+
"Romania"=>"Romania",
|
784
|
+
"Russia"=>"Russia",
|
785
|
+
"Russia"=>"Russia",
|
786
|
+
"Rwanda"=>"Rwanda",
|
787
|
+
"Saint Helena"=>"Saint Helena",
|
788
|
+
"Saint Kitts and Nevis"=>"Saint Kitts and Nevis",
|
789
|
+
"Saint Lucia"=>"Saint Lucia",
|
790
|
+
"Saint Pierre and Miquelon"=>"Saint Pierre and Miquelon",
|
791
|
+
"Saint Vincent and The Grenadines"=>"Saint Vincent and The Grenadines",
|
792
|
+
"Samoa"=>"Samoa",
|
793
|
+
"San Marino"=>"San Marino",
|
794
|
+
"Sao Tome and Principe"=>"Sao Tome and Principe",
|
795
|
+
"Saudi Arabia"=>"Saudi Arabia",
|
796
|
+
"Senegal"=>"Senegal",
|
797
|
+
"Serbia and Montenegro"=>"Serbia and Montenegro",
|
798
|
+
"Seychelles"=>"Seychelles",
|
799
|
+
"Sierra Leone"=>"Sierra Leone",
|
800
|
+
"Singapore"=>"Singapore",
|
801
|
+
"Slovakia"=>"Slovakia",
|
802
|
+
"Slovenia"=>"Slovenia",
|
803
|
+
"Solomon Islands"=>"Solomon Islands",
|
804
|
+
"Somalia"=>"Somalia",
|
805
|
+
"South Africa"=>"South Africa",
|
806
|
+
"South Georgia and The South Sandwich Islands"=>"South Georgia and The South Sandwich Islands",
|
807
|
+
"Spain"=>"Spain",
|
808
|
+
"Sri Lanka"=>"Sri Lanka",
|
809
|
+
"Sudan"=>"Sudan",
|
810
|
+
"Suriname"=>"Suriname",
|
811
|
+
"Svalbard and Jan Mayen"=>"Svalbard and Jan Mayen",
|
812
|
+
"Swaziland"=>"Swaziland",
|
813
|
+
"Sweden"=>"Sweden",
|
814
|
+
"Switzerland"=>"Switzerland",
|
815
|
+
"Syria"=>"Syria",
|
816
|
+
"Taiwan"=>"Taiwan",
|
817
|
+
"Tajikistan"=>"Tajikistan",
|
818
|
+
"Tanzania, United Republic of"=>"Tanzania, United Republic of",
|
819
|
+
"Thailand"=>"Thailand",
|
820
|
+
"Timor-leste"=>"Timor-leste",
|
821
|
+
"Togo"=>"Togo",
|
822
|
+
"Tokelau"=>"Tokelau",
|
823
|
+
"Tonga"=>"Tonga",
|
824
|
+
"Trinidad and Tobago"=>"Trinidad and Tobago",
|
825
|
+
"Tunisia"=>"Tunisia",
|
826
|
+
"Turkey"=>"Turkey",
|
827
|
+
"Turkey"=>"Turkey",
|
828
|
+
"Turkmenistan"=>"Turkmenistan",
|
829
|
+
"Turks and Caicos Islands"=>"Turks and Caicos Islands",
|
830
|
+
"Tuvalu"=>"Tuvalu",
|
831
|
+
"Uganda"=>"Uganda",
|
832
|
+
"Ukraine"=>"Ukraine",
|
833
|
+
"United Arab Emirates"=>"United Arab Emirates",
|
834
|
+
"United Kingdom"=>"United Kingdom",
|
835
|
+
"United States"=>"United States",
|
836
|
+
"U.S."=>"United States",
|
837
|
+
"United States Minor Outlying Islands"=>"United States Minor Outlying Islands",
|
838
|
+
"Uruguay"=>"Uruguay",
|
839
|
+
"Uzbekistan"=>"Uzbekistan",
|
840
|
+
"Vanuatu"=>"Vanuatu",
|
841
|
+
"Vatican City"=>"Vatican City",
|
842
|
+
"Venezuela"=>"Venezuela",
|
843
|
+
"Vietnam"=>"Vietnam",
|
844
|
+
"Virgin Islands, British"=>"Virgin Islands, British",
|
845
|
+
"Virgin Islands, U.S."=>"Virgin Islands, U.S.",
|
846
|
+
"Wallis and Futuna"=>"Wallis and Futuna",
|
847
|
+
"Western Sahara"=>"Western Sahara",
|
848
|
+
"Yemen"=>"Yemen",
|
849
|
+
"Yemen"=>"Yemen",
|
850
|
+
"Zambia"=>"Zambia",
|
851
|
+
"Zimbabwe"=>"Zimbabwe"
|
852
|
+
|
602
853
|
|
603
854
|
]
|
604
855
|
|
605
856
|
|
606
857
|
words.each do |i|
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
end
|
858
|
+
temp = "#{cities[i]}"
|
859
|
+
if (temp != "")
|
860
|
+
cityArray.push(temp)
|
861
|
+
end
|
862
|
+
end
|
863
|
+
cityArray.first
|
864
|
+
end
|
865
|
+
end
|
data/test/test_geoParser.rb
CHANGED
@@ -13,6 +13,10 @@ class GeoParserTest < Minitest::Test
|
|
13
13
|
assert_equal "Vancouver", GeoParser.getLocation("Vancouver is different than Boston")
|
14
14
|
end
|
15
15
|
|
16
|
-
|
16
|
+
def test_3
|
17
|
+
# Returns nil if no city is found
|
18
|
+
assert_equal nil, GeoParser.getLocation("This string contains no city names")
|
19
|
+
end
|
20
|
+
|
17
21
|
|
18
22
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: GeoParser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Hiland
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Mine a given string for city names.
|
14
14
|
email: g2c9@ugrad.cs.ubc.ca
|