A girl in Georgetown, Ohio, can thank a teacher who was administering an online test for getting her out of an alleged horrible situation.

The teacher asked her what was wrong after the girl was having trouble paying attention, The News Democrat of Georgetown reported.

The girl told the teacher she was hungry and was only allowed to eat a small plate of rice, The Associated Press reported.

>> Read more trending news

She was being home-schooled and the test was being given to her to continue the program.

The teacher reached out to police, who found the girl and removed her from the home.

Police said she weighed 47 pounds or about 30 pounds under the average weight of a girl her age when she was found in September, the AP reported.

Not only was she malnourished, but she was also living in filth and kept in isolation for at least three years, sleeping on a urine-stained mattress and forced to wear a diaper.

She lived in a locked trailer monitored by security cameras, Brown County Prosecutor Zac Corbin said, according to the AP.

The girl's guardians admitted to having a camera in her room because she would try to get out, police said.

Margaret Breeze has been charged with child endangering, kidnapping and felonious assault and pleaded not guilty, the AP reported.

The girl had been living with Breeze since the woman was granted custody when the girl was 6 years old. Police said she was last taken to a doctor when she was 8, the AP reported.

The girl spent two weeks in the hospital being treated for the effects of being malnourished, and has gained 15 pounds since she was rescued, the AP reported.