<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 OCR_lib_test
This file includes test scripts for the OCR_lib functions.
Step1:  Test for function word_to_vec
Given a valid word string and make sure the output array of embeddings is the same as the ground truth.
Note
Step2:  Test for reshape_embeddings()
Test the reshape function with random generated arrays
Step3:  Test for detect_text()
Input a sample image and determine if the returned OCR text is similar with the texts on the original image file.
<ASSISTANT_TASK:>
Python Code:
from OCR_lib import word_to_vec, reshape_embeddings, detect_text
import spacy
import tensorflow as tf
import numpy as np
from PIL import Image, ImageShow
import IPython.display as display
Explanation: OCR_lib_test
This file includes test scripts for the OCR_lib functions.
End of explanation
TEST_STRING = "Test string"
word_embedding = word_to_vec("Test")
nlp = spacy.load("en_core_web_lg")
ground_truth_embedding = nlp("Test")
assert ground_truth_embedding.vector.all() == word_embedding.all()
Explanation: Test for function word_to_vec
Given a valid word string and make sure the output array of embeddings is the same as the ground truth.
Note: The word_to_vec will ignore words that are not in the dictionary. So the TEST_STRING should be a sentence with words that are in the English vocabulary.
End of explanation
DEFAULT_SHAPE = (64, 64, 1)
TEST_ARRAYS = [np.random.rand(0), np.random.rand(10), np.random.rand(1000)]
for array in TEST_ARRAYS:
    new_embedding = reshape_embeddings(array)
    assert new_embedding.numpy().shape == DEFAULT_SHAPE
Explanation: Test for reshape_embeddings()
Test the reshape function with random generated arrays
End of explanation
IMG_PATH = './TC11/svt1/train/00_01.jpg'
img = Image.open(IMG_PATH, "r")
texts = detect_text(img)
print(texts)
display.display(img)
Explanation: Test for detect_text()
Input a sample image and determine if the returned OCR text is similar with the texts on the original image file.
End of explanation
<END_TASK>