{"id":1704,"date":"2010-11-08T16:31:45","date_gmt":"2010-11-08T16:31:45","guid":{"rendered":"http:\/\/www.bartbusschots.ie\/blog\/?p=1704"},"modified":"2010-11-08T16:37:42","modified_gmt":"2010-11-08T16:37:42","slug":"longest-word-with-just-half-a-keyboard","status":"publish","type":"post","link":"https:\/\/www.bartbusschots.ie\/s\/2010\/11\/08\/longest-word-with-just-half-a-keyboard\/","title":{"rendered":"Longest Word With Just Half a Keyboard?"},"content":{"rendered":"<p>As some of you may know, I&#8217;ve been ill for the past few weeks now, and hence not working or podcasting. I spend a lot of my time doing nothing because I have no energy and often a headache, but when my head is clear I have a lot of thinking time since doing physical things is not possible. I even need to be careful not to type too much or my arms get very sore!<\/p>\n<p>Anyhow &#8211; yesterday <a href=\"http:\/\/www.brendanfinan.com\/\" target=\"_blank\">Bren Finan<\/a> was chatting with me when he noticed that &#8216;yesterday&#8217; uses only keys from one half of the keyboard. Which got him, and hence me, wondering if there was a longer word that can be written with just half a keyboard. (The quick-witted among you will probably spot that &#8216;Yesterday&#8217; doesn&#8217;t actually count because the &#8216;y&#8217; is on the wrong side of the divide on ergonomic keyboards.)<\/p>\n<p><!--more-->As I say, the conversation got me thinking, and I mentioned it to <a href=\"http:\/\/www.connorp.com\/\" target=\"_blank\">Connor P<\/a> when I was chatting to him later, and during that conversation the idea came to write a program to get the answer! The problem then was that I&#8217;d need a dictionary file. Connor soon found the answer on Google, the Mac has a built-in word list in <code>\/usr\/share\/dict\/words<\/code>! So, all it took was a few lines of Perl:<\/p>\n<pre class=\"brush: perl; title: ; notranslate\" title=\"\">\r\n#!\/usr\/bin\/perl\r\nuse strict;\r\n\r\nmy $longestLeft, my $longestRight;\r\n\r\nwhile(&lt;&gt;){\r\n    my $validLeft = $_ unless m\/&#x5B;yuiophjklnm]\/i;\r\n    my $validRight = $_ unless m\/&#x5B;qwertasdfgzxcvb]\/i;\r\n    $longestLeft = $validLeft if length($validLeft) &gt; length($longestLeft);\r\n    $longestRight = $validRight if length($validRight) &gt; length($longestRight);\r\n}\r\n\r\nprint &quot;Longest left-only: $longestLeft\\nLongest right-only: $longestRight\\n&quot;;\r\n<\/pre>\n<p>The answer, the longest left-only word is &#8216;aftercataract&#8217;, and the longest right-only word is &#8216;phyllophyllin&#8217;!<\/p>\n<p>Of coruse, once I started thinking about this I also wanted a list of long words, so I did a few teaks to the code, and produced this <em>delux<\/em> version:<\/p>\n<pre class=\"brush: perl; title: ; notranslate\" title=\"\">\r\n#!\/usr\/bin\/perl\r\nuse strict;\r\n\r\n# declare the needed variables\r\nmy $longestLeft, my $longestRight, my $minLength=10;\r\nmy @longLeftWords, my @longRightWords;\r\n\r\n# loop through the dictionary (file name to be passed as only argument)\r\nwhile(&lt;&gt;){\r\n    chomp;\r\n    unless(m\/&#x5B;yuiophjklnm]\/i){\r\n        # valid left-only word\r\n        push(@longLeftWords, $_) if length($_) &gt;= $minLength;\r\n        $longestLeft = $_ if length($_) &gt; length($longestLeft);\r\n    }\r\n    unless(m\/&#x5B;qwertasdfgzxcvb]\/i){\r\n        # valid right-only word\r\n        push(@longRightWords, $_) if length($_) &gt;= $minLength;\r\n        $longestRight = $_ if length($_) &gt; length($longestRight);\r\n    }\r\n}\r\n\r\n# print the results\r\nprint &quot;\\nLong words (at least $minLength letters) with the left-side of the KB only:\\n&quot;;\r\nforeach my $word (@longLeftWords){\r\n    print &quot;\\t$word\\n&quot;;\r\n}\r\nprint &quot;\\t\\t(total: &quot;.scalar(@longLeftWords).&quot;)\\n&quot;;\r\nprint &quot;\\nLong words (at least $minLength letters) with the rightside of the KB only:\\n&quot;;\r\nforeach my $word (@longRightWords){\r\n    print &quot;\\t$word\\n&quot;;\r\n}\r\nprint &quot;\\t\\t(total: &quot;.scalar(@longRightWords).&quot;)\\n&quot;;\r\nprint &quot;\\nLongest left-only word: $longestLeft (&quot;.length($longestLeft).&quot; letters)\\n&quot;;\r\nprint &quot;Longest right-only word: $longestRight (&quot;.length($longestLeft).&quot; letters)\\n\\n&quot;;\r\n<\/pre>\n<p>This gives the following results:<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nbartmbp:Temp bart$ .\/dict.pl \/usr\/share\/dict\/words \r\n\r\nLong words (at least 10 letters) with the left-side of the KB only:\r\n\tabracadabra\r\n\tabstracted\r\n\tabstracter\r\n\tActaeaceae\r\n\tafterbreast\r\n\taftercareer\r\n\taftercataract\r\n\taftereffect\r\n\taftergrass\r\n\taftergrave\r\n\tafterstate\r\n\taftertaste\r\n\tafterwards\r\n\tAggregatae\r\n\tasarabacca\r\n\tassertress\r\n\tasseverate\r\n\tAsteraceae\r\n\tbadgerweed\r\n\tbeaverette\r\n\tbedaggered\r\n\tbegartered\r\n\tbeggarweed\r\n\tbesweatered\r\n\tbetattered\r\n\tbettergates\r\n\tbreastweed\r\n\tcataracted\r\n\tdecerebrate\r\n\tdefervesce\r\n\tdesecrater\r\n\tdesertress\r\n\tdesertward\r\n\tdetractress\r\n\tdevertebrated\r\n\tebracteate\r\n\teffervesce\r\n\testafetted\r\n\teverbearer\r\n\tEvertebrata\r\n\tevertebrate\r\n\texacerbate\r\n\texaggerate\r\n\texaggerated\r\n\textrastate\r\n\textravagate\r\n\textravasate\r\n\tfreetrader\r\n\tGastraeadae\r\n\tgazetteerage\r\n\tgrasswards\r\n\tgravestead\r\n\tgravewards\r\n\treaggravate\r\n\treaggregate\r\n\treasseverate\r\n\tredecrease\r\n\tredefecate\r\n\trefederate\r\n\tregratress\r\n\tResedaceae\r\n\tretraverse\r\n\trevegetate\r\n\treverberate\r\n\treverbrate\r\n\tsettergrass\r\n\tstagecraft\r\n\tstaggerweed\r\n\tstarveacre\r\n\tstatecraft\r\n\tstavesacre\r\n\tstewardess\r\n\tstreetward\r\n\tsweetbread\r\n\tsweetwater\r\n\ttartarated\r\n\tterracette\r\n\tterracewards\r\n\ttessaradecad\r\n\ttesseradecade\r\n\ttesserated\r\n\ttradecraft\r\n\tTrastevere\r\n\tversecraft\r\n\tVertebrata\r\n\tvertebrate\r\n\tvertebrated\r\n\twaterstead\r\n\twaterwards\r\n\twesterwards\r\n\t\t(total: 90)\r\n\r\nLong words (at least 10 letters) with the rightside of the KB only:\r\n\thypolimnion\r\n\thypophyllium\r\n\thypophyllum\r\n\tmiminypiminy\r\n\tphyllophyllin\r\n\tPlynlymmon\r\n\tpolyphonium\r\n\tpolyphylly\r\n\t\t(total: 8)\r\n\r\nLongest left-only word: aftercataract (13 letters)\r\nLongest right-only word: phyllophyllin (13 letters)\r\n\r\nbartmbp:Temp bart$\r\n<\/pre>\n<p>This tells me two things, firstly, that Perl is really good at analysing text, because on my 5 year old Macbook Pro that took about a second to run, and second, that there are FAR more words for the left side than the right side.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As some of you may know, I&#8217;ve been ill for the past few weeks now, and hence not working or podcasting. I spend a lot of my time doing nothing because I have no energy and often a headache, but when my head is clear I have a lot of thinking time since doing physical [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[1,12],"tags":[],"series":[],"class_list":["post-1704","post","type-post","status-publish","format-standard","hentry","category-uncategorized","category-computers-tech"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p7t9xK-ru","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts\/1704","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/comments?post=1704"}],"version-history":[{"count":2,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts\/1704\/revisions"}],"predecessor-version":[{"id":1706,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/posts\/1704\/revisions\/1706"}],"wp:attachment":[{"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/media?parent=1704"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/categories?post=1704"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/tags?post=1704"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.bartbusschots.ie\/s\/wp-json\/wp\/v2\/series?post=1704"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}