antooro / flagsmashupbot Goto Github PK
View Code? Open in Web Editor NEWSource code for the Twitter Bot
License: MIT License
Source code for the Twitter Bot
License: MIT License
After changing the API endpoint in #8 and spending some time analyzing the naming function, I think there is a more mashable way of doing it. I would really like for it to be discussed a bit, if possible:
Instead of going split by split in each name and checking if it is valid, and then checking again before returning it, it is possible to get all splits for each given country, join those splits from the first with the ones from the second, and randomly select one of the resulting options.
A few things to point out:
"{country_name} 2"
if both countries are the same oneSenegal
and Portugal
returning Senegal
.Cocos (Keeling) Island
. In that case the parenthesis are removed and Keeling is used as part of the nameSaint Helena, Ascension and Tristan da Cunha
, where the comma does not interfere with the namingTrinidad and Tobago
and Jamaica
would yield Trinidad Jamaica
. Now, it would be something along the lines of Trinidad and Tomaica
(see the examples with a single and multiword country). But still can be reverted or something.(length of the LONGEST country selected) - 1
(length of the SHORTEST country selected) + 1
Niue
, so in that case I return it directly. This would also remove the check for it in the checkMashupValid
function in formatsvg.py
Code for this can be found here with unit tests done tests here
It can also be manually tested by checking out the code and running
python3 names.py '{country_name}' '{another_country_name}'
Using Mozambique and Guatemala
Start options are: mo, moza, mozambi
End options are: temala, mala, la
Combinations are: mozatemala, mozambitemala, mozambimala, mozambila
Using Trinidad and Tobago and Jamaica
Start options are: tri, trini, trinida, trinidad a, trinidad and to, trinidad and toba
End options are: maica, ca
Combinations are: trinidad and tomaica, trinidad and tobamaica, trinidad and tobaca
#################
# Same example but swapping both countries
#################
Using Jamaica and Trinidad and Tobago
Start options are: ja, jamai
End options are: nidad and tobago, dad and tobago, d and tobago, nd tobago, bago, go
Combinations are: janidad and tobago, jamainidad and tobago, jamaidad and tobago
Using Antigua and Barbuda and Saint Kitts and Nevis
Start options are: a, anti, antigua, antigua a, antigua and ba, antigua and barbu
End options are: nt kitts and nevis, tts and nevis, nd nevis, vis, s
Combinations are: antint kitts and nevis, antiguant kitts and nevis, antiguatts and nevis,
antigua ant kitts and nevis, antigua atts and nevis, antigua and bant kitts and nevis,
antigua and batts and nevis, antigua and band nevis, antigua and barbunt kitts and nevis,
antigua and barbutts and nevis, antigua and barbund nevis, antigua and barbuvis
I believe people will be civil enough to understand that the API used is provided by the internet and the names used are not generated by the bot. But there are cases like the Islas Malvinas, or Falkland Islands, that with the new API are just Falkland Islands. With the code that the bot runs (not with this PR), that name would be taken in as Malvinas Falkland Islands, and on mashups it will show as either Malvinas Falklands {something_else}
or {something_else} Islands
.
I am sure there are a few other issues like this, but this is the only one I know of so far.
The solutions I have for this are either
Using Malvinas Falkland Islands and French Polynesia
Start options are: ma, malvi, malvina, malvinas fa, malvinas falkla, malvinas falkland i, malvinas falkland isla
End options are: nch polynesia, lynesia, nesia, sia
Combinations are: malvinch polynesia, malvinanch polynesia, malvinas fanch polynesia, malvinas falynesia, malvinas falklanch polynesia, malvinas falklalynesia, malvinas falklanesia, malvinas falklasia, malvinas falkland inch polynesia, malvinas falkland ilynesia, malvinas falkland inesia, malvinas falkland isia, malvinas falkland islanch polynesia, malvinas falkland islalynesia, malvinas falkland islanesia, malvinas falkland islasia
The bot's code is currently not licensed. This means that by default it is fully copyrighted and cannot be legally copied.
The most common license for this type of project is the MIT or Expat license, which is a "permissive" license that essentially allows anyone to do anything with the code as long as they preserve attribution.
I believe GitHub has a way to automatically apply common licenses.
The flag on Twitter is the Bartram proposal and the flag on the website is the Antarctic Treaty logo. There is a new flag called True South that is more officially recognized and is probably better to use. https://en.wikipedia.org/wiki/Flag_of_Antarctica
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.