Woody words, tinny words
Python 2, 99 73 65 64 63 bytes
lambda s:'PVC'*('ea'in s)or'wtoiondnyy'[s[-2:]in'instperit'::2]
Try it online!
Alternatives also with 63 bytes:
lambda s:'PVC'*('ea'in s)or'wtoiondnyy'[s[-6::5]in'dtenmsr'::2]
lambda s:'PVC'*('ea'in s)or'wtoiondnyy'[s[::5]in'lrinaosit'::2]
Python 2, 62 bytes
lambda n:'wtPoiVonCdn yy'[hash(n)%97%78%28%15%2+('ea'in n)::3]
Try it online!
How?
This submission uses the fact that the hash
function is stable for strings in Python 2. Each valid input has a valid output. The brute-forced repeated modulo %97%78%28%15%2
returns 1
for all tinny and PVC words and 0
for woody words. By adding the value of ('ea' in n)
to it, we get 2
instead of 1
for the input 'leap'. Here is a table of all values:
+----------------+----------------------+----------------+-------------+-------+
| word | hash | %97%78%28%15%2 | +('ea'in n) | type |
+----------------+----------------------+----------------+-------------+-------+
| leap | 5971033325577305778 | 1 | 2 | PVC |
+----------------+----------------------+----------------+-------------+-------+
| litter bin | 2393495108601941061 | 1 | 1 | tinny |
| newspaper | 1961680444266253688 | 1 | 1 | tinny |
| antelope | -2930683648135325182 | 1 | 1 | tinny |
| recidivist | -1480015990384891890 | 1 | 1 | tinny |
| tit | -1495230934635649112 | 1 | 1 | tinny |
| simpkins | 672871834662484926 | 1 | 1 | tinny |
+----------------+----------------------+----------------+-------------+-------+
| gone | 3644900746337488769 | 0 | 0 | woody |
| sausage | 4880706293475915938 | 0 | 0 | woody |
| seemly | -8112698809316686755 | 0 | 0 | woody |
| prodding | 7325980211772477495 | 0 | 0 | woody |
| vacuum | -5283515051184812457 | 0 | 0 | woody |
| bound | -6522768127315073267 | 0 | 0 | woody |
| vole | -7823607590901614336 | 0 | 0 | woody |
| caribou | -3644594841083815940 | 0 | 0 | woody |
| intercourse | 2499732157679168166 | 0 | 0 | woody |
| pert | 4142553773863848247 | 0 | 0 | woody |
| thighs | -3490317966011085195 | 0 | 0 | woody |
| botty | -6522767127163072681 | 0 | 0 | woody |
| erogenous zone | 7046120593231489339 | 0 | 0 | woody |
| ocelot | -6961879712146820842 | 0 | 0 | woody |
| wasp | -3668927459619339511 | 0 | 0 | woody |
| yowling | 6823632481520320220 | 0 | 0 | woody |
+----------------+----------------------+----------------+-------------+-------+
The type to return is now extracted from the string 'wtPoiVonCdn yy'
by taking every third character, starting at the calculated index.
JavaScript (ES6), Chrome/Edge, 54 bytes
Because the behavior of parseInt()
on large inputs with a radix of 36 is implementation-dependent, this one doesn't work with SpiderMonkey (Firefox).
s=>[,'PVC',,'Tinny'][parseInt(s+383,36)%69%7]||'Woody'
Try it online!
How?
The hash function returns 3 for Tinny words, 1 for PVC and either 0, 4, 5 or 6 for Woody words. The words marked with an asterisk are implicitly truncated because space is considered as an invalid character by parseInt().
word | +383 | base 36 -> decimal | mod 69 | mod 7
---------------+----------------+-----------------------+--------+------
gone | gone383 | 36318994131 | 54 | 5
sausage | sausage383 | 2874302392811475 | 42 | 0
seemly | seemly383 | 80120017777107 | 6 | 6
prodding | prodding383 | 94214834629477200 | 12 | 5
vacuum | vacuum383 | 88266035564499 | 60 | 4
bound | bound383 | 916101808275 | 6 | 6
vole | vole383 | 68967369939 | 39 | 4
caribou | caribou383 | 1249086300450771 | 63 | 0
intercourse | intercourse383 | 3.183324871563264e+21 | 11 | 4
pert | pert383 | 55312791699 | 21 | 0
thighs | thighs383 | 83184557510739 | 6 | 6
botty | botty383 | 916052399571 | 63 | 0
erogenous zone | erogenous (*) | 41664605989780 | 7 | 0
ocelot | ocelot383 | 68678794158483 | 39 | 4
wasp | wasp383 | 70309896339 | 63 | 0
yowling | yowling383 | 3523299657958227 | 39 | 4
---------------+----------------+-----------------------+--------+------
litter bin | litter (*) | 1301413923 | 24 | 3
newspaper | newspaper383 | 3081816298632183000 | 3 | 3
antelope | antelope383 | 38980419895881940 | 24 | 3
recidivist | recidivist383 | 129824740122576960000 | 3 | 3
tit | tit383 | 1785109395 | 45 | 3
simpkins | simpkins383 | 104264583727840850 | 24 | 3
---------------+----------------+-----------------------+--------+------
leap | leap383 | 46576922259 | 57 | 1
Previous version, 59 57 bytes
s=>['Woody','Tinny','PVC'][82178>>parseInt(s,35)%50%26&3]
Try it online!
How?
Below are the different steps of the function for each input. The result of the first modulo is an approximation within the precision of JS numbers and is mathematically invalid for intercourse.
input | base-35 -> dec. | %50 | %26 | 00000000010100000100000010
---------------+-------------------+-----+-----+---------------------------
gone | 716219 | 19 | 19 | 00------------------>
sausage | 52042888324 | 24 | 24 | 00----------------------->
seemly | 1492249219 | 19 | 19 | 00------------------>
prodding | 1659396207121 | 21 | 21 | 00-------------------->
vacuum | 1643736697 | 47 | 21 | 00-------------------->
bound | 17573443 | 43 | 17 | 00---------------->
vole | 1359274 | 24 | 24 | 00----------------------->
caribou | 22625709220 | 20 | 20 | 00------------------->
intercourse | 51532867489988450 | 48 | 22 | 00--------------------->
pert | 1089999 | 49 | 23 | 00---------------------->
thighs | 1549436973 | 23 | 23 | 00---------------------->
botty | 17572449 | 49 | 23 | 00---------------------->
erogenous zone | 33308397234728 | 28 | 2 | 00->
ocelot | 1279159344 | 44 | 18 | 00----------------->
wasp | 1385255 | 5 | 5 | 00---->
yowling | 63810499496 | 46 | 20 | 00------------------->
litter bin | 1131250042 | 42 | 16 | 01--------------->
newspaper | 52754217228642 | 42 | 16 | 01--------------->
antelope | 687218151914 | 14 | 14 | 01------------->
recidivist | 2160354371100934 | 34 | 8 | 01------->
tit | 36184 | 34 | 8 | 01------->
simpkins | 1835782971008 | 8 | 8 | 01------->
leap | 917900 | 0 | 0 | 10