Skip to content

Commit

Permalink
Fix howtos splitting
Browse files Browse the repository at this point in the history
- Bump to 0.13.10
  • Loading branch information
smathot committed Mar 20, 2024
1 parent 4d74b47 commit e568dea
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion heymans/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""AI-based chatbot that provides sensible answers based on documentation"""

__version__ = '0.13.9'
__version__ = '0.13.10'
11 changes: 2 additions & 9 deletions sources/jsonl/opensesame-howtos.jsonl
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,9 @@
{"content": "If you need help with OpenSesame, there are several places you can look:\n\n1. Consult the built-in help documentation by clicking the help buttons that appear throughout the interface, or by clicking Help in the main menu. This will open the documentation in your web browser.\n2. Visit the documentation website at [osdoc.cogsci.nl](https://osdoc.cogsci.nl). This site contains an extensive manual as well as several step-by-step tutorials.\n3. Watch video tutorials on the [YouTube channel](https://www.youtube.com/sebastiaanmathot). These videos cover many basic topics to help you get started with OpenSesame.\n4. Ask a question on the [OpenSesame forum](https://forum.cogsci.nl). This forum is the main place for getting personalized help with OpenSesame. Be sure to include enough details, such as a description of what you are trying to achieve, and screenshots of things that you need help with.\n5. Ask me! As an AI assistant with access to the OpenSesame documentation, I will be able to help you with many things.", "url": "https://forum.cogsci.nl", "title": "How to find help when working with OpenSesame"}
{"content": "To share an experiment with others, so that they can run and/ or inspect the experiment themselves, you can take the following steps:\n\n1. In OpenSesame, open the experiment that you would like to share.\n2. Make sure that the experiment contains no sensitive information, such as participant data.\n3. Save the experiment and close it.\n4. Locate the experiment file (`.osexp`) on your computer.\n5. Upload this file to a file sharing service, such as Google Drive, Dropbox, or the Open Science Framework (OSF).\n6. Once the upload is complete, make sure that the file is shared with the intended recipients.\n7. Send the download link to the people with whom you want to share the experiment.\n8. The recipients can then download the experiment and open it in their own copy of OpenSesame.", "url": "https://forum.cogsci.nl", "title": "How to share an experiment with others"}
{"content": "To import (open) an experiment into OpenSesame, for example an experiment that someone else has shared with you, take the following steps:\n\n1. Download the experiment file, which should have the `.osexp` extension, to your computer.\n2. Launch OpenSesame.\n3. In the menu, click on File \u2192 Open and browse to the location where you have downloaded the `.osexp` file.\n4. Select the `.osexp` file and click on 'Open'.\n5. The downloaded experiment will now open in OpenSesame.", "url": "https://forum.cogsci.nl", "title": "How to import (open) an experiment into OpenSesame"}
{"content": "To get the coordinates of the last character in a Text element:\n\n1. Create a Text element on your canvas with the desired sentence except for the last character. So if you want the coordinates of the 'i' in 'sigmundai', you would use the string 'sigmunda'.\n2. Use the `boundingbox` property of the Text element to get the bounding box of the entire text string. The bounding box is a tuple of four values: (left, top, right, bottom).\n3. The x-coordinate of the last character (i.e. the 'i' in this example) will be approximately equal to the `right` value of the bounding box.\n4. To get the y-coordinate of the last character, you can use the `top` or `bottom` value of the bounding box, depending on whether you want the coordinate of the top or bottom of the character.\n5. If needed, you can adjust the x-coordinate by subtracting a small value to account for any padding on the right side of the text.\n\n```python\nmy_text = 'sigmundai'\nmy_canvas = Canvas()\nmy_canvas['sentence'] = Text(my_text[:-1])\nbbox = my_canvas['sentence'].rect", "url": "https://forum.cogsci.nl", "title": "How to get the coordinates of the last character in a Text element"}
{"content": "last_char_x = bbox[2]", "url": "https://forum.cogsci.nl", "title": "important: not bounding_box"}
{"content": "last_char_y = bbox[1]", "url": "https://forum.cogsci.nl", "title": "right coordinate of the bounding box"}
{"content": "```", "url": "https://forum.cogsci.nl", "title": "top coordinate of the bounding box"}
{"content": "To get the coordinates of the last character in a Text element:\n\n1. Create a Text element on your canvas with the desired sentence except for the last character. So if you want the coordinates of the 'i' in 'sigmundai', you would use the string 'sigmunda'.\n2. Use the `boundingbox` property of the Text element to get the bounding box of the entire text string. The bounding box is a tuple of four values: (left, top, right, bottom).\n3. The x-coordinate of the last character (i.e. the 'i' in this example) will be approximately equal to the `right` value of the bounding box.\n4. To get the y-coordinate of the last character, you can use the `top` or `bottom` value of the bounding box, depending on whether you want the coordinate of the top or bottom of the character.\n5. If needed, you can adjust the x-coordinate by subtracting a small value to account for any padding on the right side of the text.\n\n```python\nmy_text = 'sigmundai'\nmy_canvas = Canvas()\nmy_canvas['sentence'] = Text(my_text[:-1])\nbbox = my_canvas['sentence'].rect # important: not bounding_box\nlast_char_x = bbox[2] # right coordinate of the bounding box\nlast_char_y = bbox[1] # top coordinate of the bounding box\n```", "url": "https://forum.cogsci.nl", "title": "How to get the coordinates of the last character in a Text element"}
{"content": "To calculate the width of a Text element:\n\n1. Create a Canvas object.\n3. Calculate the width of a text (without rendering it) using the `text_size()` function.\n\n```python\nmy_text = 'sigmundai'\nmy_canvas = Canvas()\nwidth, height = my_canvas.text_size(my_text)\n```", "url": "https://forum.cogsci.nl", "title": "How to calculate the width of a Text element"}
{"content": "To adjust the position of a Text element based on its length:\n\n1. Create a Text element on your canvas with the desired sentence.\n2. Use the `boundingbox` property of the Text element to get the bounding box of the entire text string.\n3. Calculate the width of the Text element by subtracting the `left` value from the `right` value of the bounding box.\n4. Set the `x` property of the Text element to the negative half of the text width to center the text horizontally on the canvas.\n5. If needed, you can also adjust the `y` property of the Text element to vertically position the text as desired.\n\n```python\nmy_text = 'sigmundai'\nmy_canvas = Canvas()\nmy_canvas['sentence'] = Text(my_text[:-1], center=False)\nbbox = my_canvas['sentence'].rect", "url": "https://forum.cogsci.nl", "title": "How to adjust the position of a Text element based on its length"}
{"content": "text_width = bbox[2] - bbox[0]", "url": "https://forum.cogsci.nl", "title": "important: not bounding_box"}
{"content": "my_canvas['sentence'].x = -text_width", "url": "https://forum.cogsci.nl", "title": "right - left"}
{"content": "my_canvas['sentence'].y = 0", "url": "https://forum.cogsci.nl", "title": "move the text left so that it runs until the center of the screen"}
{"content": "```", "url": "https://forum.cogsci.nl", "title": "set the vertical position as needed"}
{"content": "To adjust the position of a Text element based on its length:\n\n1. Create a Text element on your canvas with the desired sentence.\n2. Use the `boundingbox` property of the Text element to get the bounding box of the entire text string.\n3. Calculate the width of the Text element by subtracting the `left` value from the `right` value of the bounding box.\n4. Set the `x` property of the Text element to the negative half of the text width to center the text horizontally on the canvas.\n5. If needed, you can also adjust the `y` property of the Text element to vertically position the text as desired.\n\n```python\nmy_text = 'sigmundai'\nmy_canvas = Canvas()\nmy_canvas['sentence'] = Text(my_text[:-1], center=False)\nbbox = my_canvas['sentence'].rect # important: not bounding_box\ntext_width = bbox[2] - bbox[0] # right - left\nmy_canvas['sentence'].x = -text_width # move the text left so that it runs until the center of the screen\nmy_canvas['sentence'].y = 0 # set the vertical position as needed\n```", "url": "https://forum.cogsci.nl", "title": "How to adjust the position of a Text element based on its length"}
{"content": "To use a response collected in a KEYBOARD_RESPONSE item in a run-if expression to select which item is run:\n\n1. In a SEQUENCE item, set the run-if expression of one child item to `response == 'left'` to execute it only if the left arrow was pressed. \n2. Set the run-if statement of another child item to `response == 'right'` to execute it only if the right arrow was pressed.\n3. Run-if expressions should be valid Python expressions.", "url": "https://forum.cogsci.nl", "title": "How to use a response in a run-if expression"}
{"content": "To use JavaScript code in an experiment running in OSWeb:\n\n1. Insert an INLINE_JAVASCRIPT item into your experiment\n2. For code that needs to be executed during preparation (for example the preparation of a trial in the case of a trial SEQUENCE), use the 'Prepare' phase\n3. For code that needs to be executed during executing, use the 'Run' phase\n4. Avoid naming conflicts with variables defined in the other parts of the experiment\n5. Global variables from INLINE_JAVASCRIPT items are also available in the user interface, for example in run-if expressions\n6. Variables from the user interface, for example response variables, are available as global variables in INLINE_JAVASCRIPT items", "url": "https://forum.cogsci.nl", "title": "How to use JavaScript code in an OSWeb experiment"}
{"content": "To create a recall trial where an image is shown and the participant types in a response in OSWeb, you can use an INLINE_HTML item with the following code:\n\n\n```html\n<input type='text' name='text_response'>\n<img id='my_image_element'>\n<input type='submit' value='ok'>\n\n<script>\n// Assume that the variable `my_image` defines the name of the image in the file pool\ndocument.getElementById('my_image_element').src = pool[my_image].data.src\n</script>\n```", "url": "https://forum.cogsci.nl", "title": "How to show a form with image and text input in OSWeb"}
Expand Down

0 comments on commit e568dea

Please sign in to comment.