Spaces:
Runtime error
Runtime error
File size: 3,436 Bytes
932ddfc |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# checker.py
# List of physics keywords
physics_keywords = [
'absorptivity', 'acceleration', 'accelerometer', 'acoustics', 'adhesion', 'aerodynamics', 'albedo', 'alloy',
'ammeter', 'amplifier', 'amplitude', 'anion', 'annihilation', 'anode', 'anti-gravity', 'antimatter',
'antineutron', 'antiparticle', 'antiproton', 'antiquark', 'astrophysics', 'atom', 'axion', 'ballistics',
'barometer', 'baryon', 'battery', 'beam', 'bending', 'biocatalysis', 'biophysics', 'boson', 'bremsstrahlung',
'brittleness', 'bubble', 'buoyancy', 'calculus', 'capacitance', 'capacitor', 'cathode', 'cation', 'centigrade',
'coherence', 'cohesion', 'convection', 'creep', 'crest', 'cyclotron', 'decibel', 'deflection', 'deformation',
'density', 'derivative', 'diamagnetism', 'dielectric', 'diffraction', 'dispersion', 'displacement', 'distance',
'drag', 'ductility', 'dynamics', 'dyne', 'econophysics', 'elasticity', 'electricity', 'electrodynamics',
'electromagnet', 'electromagnetism', 'electromechanics', 'electron', 'electronegativity', 'electronics',
'electrostatics', 'electrostriction', 'emissivity', 'energy', 'endothermic', 'enthalpy', 'entropy',
'equipartition', 'exothermic', 'farad', 'faraday', 'fermion', 'ferrimagnetism', 'ferromagnetism', 'fission',
'flavour', 'fluid', 'fluorescence', 'flux', 'focus', 'frequency', 'friction', 'function', 'fusion', 'gas',
'geophysics', 'gluon', 'gravitation', 'graviton', 'gravity', 'ground', 'hadron', 'half-life', 'heat', 'hertz',
'homeokinetics', 'hydrostatics', 'impedance', 'implosion', 'impulse', 'inductance', 'infrasound', 'inertia',
'integral', 'ion', 'ionization', 'isotope', 'joule', 'kelvin', 'kinematics', 'laser', 'lepton', 'lever',
'light', 'liquid', 'm-theory', 'machine', 'magnetism', 'magnetostatics', 'mass', 'mathematics', 'matrix',
'matter', 'mechanics', 'melting', 'meson', 'molecule', 'moment', 'momentum', 'motion', 'muon', 'nanoengineering',
'nanotechnology', 'neurophysics', 'neutrino', 'neutron', 'nucleon', 'nucleus', 'nuclide', 'ohm', 'optics',
'paraffin', 'parity', 'particle', 'pendulum', 'phenomenology', 'phosphorescence', 'photon', 'photonics', 'physics',
'piezoelectricity', 'pion', 'plasma', 'plasticity', 'pneumatics', 'positron', 'power', 'pressure', 'probability',
'proton', 'pulley', 'pulse', 'quantization', 'quantum', 'quark', 'quasiparticle', 'radiation', 'radionuclide',
'redshift', 'refraction', 'relativity', 'scalar', 'scattering', 'science', 'screw', 'siphon', 'solid', 'solubility',
'sonoluminescence', 'sound', 'speed', 'statics', 'stiffness', 'strain', 'stress', 'sublimation', 'superconductivity',
'superconductor', 'temperature', 'thermodynamics', 'thermometer', 'torque', 'toughness', 'trajectory', 'transducer',
'trigonometry', 'trimean', 'vacuum', 'vector', 'viscoelasticity', 'viscosity', 'voltage', 'voltmeter', 'volume',
'wave', 'wavelength', 'wedge', 'weight', 'wind', 'work', 'x-ray'
]
def checker(query):
try:
found = False
list_of_words = query.lower().split(" ")
for word in list_of_words:
for keyword in physics_keywords:
if word in keyword.lower().split(" "):
found = True
break
if found:
break
return found
except Exception as e:
print(f"Error: {e}")
return False
|