Did they pay for their own expenses? Food, clothing, transportation, etc. Initially you would have to pay for 50% of the cost for this person to live with you. But there is still a question of whether you can claim this person as a dependent. Best to call the IRS and explain your situation to be sure.
No, you cannot claim them as a dependent since they did not live in your home for the entire year. That type of dependent would fall under the Qualifying Relative rules.
To be a Qualifying Relative -
1. The person cannot be your qualifying child or the qualifying child of any other taxpayer. A child is not the qualifying child of any other taxpayer if the child's parent (or any other person for whom the child is defined as a qualifying child) is not required to file an income tax return or files an income tax return only to get a refund on income tax withheld.
2. The person either (a) must be related to you or (b) must live with you all year as a member of your household.
3. The person's gross income for the year must be less than $4,200 (social security does not count) in 2019
4. You must provide more than half of the person's total support for the year.
5. The person must be a U.S. citizen or a U.S., Canada, or Mexico resident for some part of the year.
6. The person must not file a joint return with their spouse.