The question appears to ask for the heuristic rules of Slovenian language about the gender of physical objects. It depends on the ending of the words. The nominative case in singular is usually used for such rules.
The mapping is as follows: -a, -ev, -ost: feminine: kava, voda, marmelada, salama, breskev, hruška, hiša, cesta, luna, zemlja, miza, hiša, ladja, žlica, televizija, majica, nogavica
-o, -e: neuter: mleko, vino, pivo, jabolko, morje, nebo, sonce, letalo, okno, sadje, meso, grozdje
-consonant: masculine: čaj, kruh, sir, med, vlak, kozarec, nož, krožnik, računalnik, dež, veter, sneg, radiator, ključ, kabel, zaslon, čevelj
There are few words usually or always used in plural.
-a: neuter: očala, vrata, usta, jetra
-e: feminine: hlače, škarje, vilice
-i: feminine or masculine: smuči (f), možgani (m), starši (m)
avto (m) probably received its gender from avtomobil (m).
Luč (f), noč (f), miš (f) belong to somewhat rarer 2nd feminine declination. Learn the adjective endings and in most cases you will notice this class by adjective.
For persons, rules are a bit different.