<commit_before><?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Dic as Entity;

class DicController extends ApiController
{
    //
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        //
        $type = $request->input('type', '');
        $arr = explode(',', $type);
        if(empty($type)){
            $data = Entity::all();
        }else{
            $data = Entity::whereIn('type', $arr)->get();
        }
        return response($data, 200);
    }

    public function newEntity(array $attributes = [])
    {<commit_msg>Dic返回数据接口修改<commit_after><?php

namespace App\Http\Controllers\Api;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Models\Dic as Entity;

class DicController extends ApiController
{
    //
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index(Request $request)
    {
        //
        $type = $request->input('type', '');
        $arr = explode(',', $type);
        if(empty($type)){
            $data = Entity::all();
        }else{
            $data = Entity::whereIn('type', $arr)->get();
        }
        $result = [];
        $data->each(function($item, $key) use ($result){
            $result[$item->type] = $item;
        });

        return response($result, 200);
    }

    public function newEntity(array $attributes = [])
    {
{'fraction_non_alphanumeric': 0.15749039692701663, 'fraction_numerical': 0.0038412291933418692, 'mean_word_length': 2.209445585215606, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1875025', 'n_tokens_mistral': 474, 'n_tokens_neox': 481, 'n_words': 99}